This week I continue doing emulating ADC based on the proper protocol of SPI ADC from Microchip – MCP3204/3208

From the document table 5-1: state that to initiate a ADC read for specific channel, Master SPI will first send 4bit of ‘Control Bit Selection’ to read the data of the particular ADC channel (Slave SPI). For my application I would need to read from 16 Analog pin, therefore my control bit need to be 8bit to hold an address of ‘0x10’ assuming ‘0x00’ = Analog 1. This particular protocol is very similar to the one I implemented previously. After reading some more example (MCP3903) of SPI ADC from microchip I also learnt that there are other more advance protocol available.

SPI Slave Code with Harmony

DRV_SPI_Open();
DRV_SPI_BufferAddRead();
//The array of BufferAddRead will contain the data send from Master SPI

 

I also did make some minor changes on my previous work. PIC32 Server with Wt Client. After updating Harmony library to the latest version (v1.07). They come with a newer WolfSSL version and after some testing, my code still works perfectly.