SPI BusyPin and Watchdog implementation patch for netmf
I love netmf and GHI, but two things didn’t work the way I wanted them to with my Cerb based board.
- Microsoft.SPOT.Hardware.SPI.Configuration had a BusyPin in the constructor, but it wasn’t implemented for the STM32F4 at all. I needed this to read data sequentially at a high rate (25Mhz). Basically my 18bit ADC toggled the busy pin every 3 bytes. So I changed the SPI class to have parameters and logic that suited my needs.
The example below reads 256 18bit chunks of data using the busy pin…
Microsoft.SPOT.Hardware.SPI.Configuration spiConfig = new Microsoft.SPOT.Hardware.SPI.Configuration(CI750.Hardware.Abstracts.CPU.Pins.GPIO_PIN_B_1_AKA_RDL_SDI, false, 0, 0, true, true, 25000, CI750.Hardware.Abstracts.CPU.SPI_Devices.SPI1, CI750.Hardware.Abstracts.CPU.Pins.GPIO_PIN_C_3_AKA_ADCBUSY, false, 3);
SPI.Config = spiConfig;
byte zeroBytes = new byte;
byte data = new byte;
- The watchdog class wasn’t implemented. My fix isn’t perfect, but it works. I’ve attached my example CS class in the zip file. Essentially I’m using the Interval’s setter to kick the watchdog. Code to do this is running in a thread constantly. I’ll improve this soon.
To use this fix extract these files to your firmware folder, then re-build.