I am trying to understand the SPI serial interface between a Master MCU and a (Single) Slave ADC. Do we have 8-bits or 16-bits data word communication in SPI? Or is it un-bounded and I can send any number of continuous bits between master and slave in SPI communication?
I have used I2C bus which works in command-response cycles. Do we need to give command to SPI slave to get data from it or do we only need to assert its CS’ (Chip Select) line and provide it with serial-clock pulses to start receiving data from the slave.
- 1This entirely depends on the specific parts you have. – Jeroen3 41 mins ago
- 1Included ADC part numbers in the post. – scico111 37 mins ago
- 1What does the data sheet tell you about the SPI communications? – Andy aka 20 mins ago
- SPI can do any number of write/read bytes. I have written the following functions for newbies to learn how to do SPI programming: (1) Set up SPI buses, 0.0, 0.1, 1.0, 1.1, 1.2 (and more set up but not yet tested), (2) SPI loop back 1, 2, 3 bytes for SPI 0.0, 0.1, 1.0, 1.1, 1.2. (3) Modify loop back two bytes function as 12 bit MCP3201 read ADC results, (4) Modify loop back 3 bytes functions for read 10 bit MCP3008, 12 bit MCP3208 ADC devices. (5) Next step is to write modules for 16 to 24 bit ADC. I am writing SPI and ADC utilities in a module programming style, / to continue, … – tlfong01 19 mins ago
- I am writing the SPI and ADC functions as two modules, so that once the SPI utilities are debugged, it can be protected and cannot be modified by the user. The ADC utilities is written in a functrional and declarative style, so once debugged, the module is locked and user cannot modify the general ADC device read write register, print functions. In short the user just use the the universal, locked modules. However, the use can write new ADC functions eg. AD7622 and AD7642 and pace in an user defined module as dictionaries. / to continue, … – tlfong01 10 mins ago
- User just call the ADC utility and not even need to add one more case/switch to the already debugged module. In other words, almost everything is scalable, as Scala programming. You might like to see my not yet completed modules and give comments and suggestions, so that I can see if future users can easily write AD7622 (16-bits ADC) or AD7641 (18 bit) or even 24 bit ADC. The link to my basic SPI and ADC testing modules are: electronics.stackexchange.com/questions/515225/…. / to continue, … – tlfong01 7 mins ago
- All test functions are copy/paste/play, That is, no external libraries are required. The test functions also give sample output for newbies to verify programming and results. The programs are heavily written in heavily self documenting functional style (no newbie scary classes and objects) user can easily modify, expand, and at the same time learning structured programming and other methodologies. Cheers. – tlfong01 just now Edit