Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 8 months ago.
SPI protocol : function write
Hi everyone,
In an SPI protocol, is it possible to send more than 16 bits each per frame? And is it posible to see how is the function "write" written? I tried but did not succeed to find the code (except : virtual int write (int value) [virtual], what does this virtual mean?
Thank you in advance for your answers,
1 Answer
10 years, 8 months ago.
The SPI hardware is different from chip to chip. Most mbed devices can send 8 and 16 bit packets per hardware. You have to look into the datasheet of the cpu you use. The LPC1768 can transfer 4 - 16 bit. The chip select signal is generated by "hand", so if you set cs low, send many bytes or words with spi.write(xx) and set cs high after that, you have a big frame.
If you want the look into the code - import mbed-src to your program. (delete the normal mbed lib - you need only one)
The cpu specific code is there targets\hal\manufacturer\cpu-xx\spi_api.c This code is using the low level definitions in targets\cmsis\manufacturer
cpu-xx\xxspi.c