Hello, SPI communication is relatively simple, hence we don't have an application note available for it (other than the one from the User's Manual). After your SPI driver/framework is initialized using a call to p_api->open, you can use p_api->write to request a read from your slave device (SPI transactions are always initialized by host) followed by p_api->read that receives the data from the slave into your specified buffer. The prototype for read and write is the same: p_api->write/read(p_ctrl, p_data, data_size, bit_width). Where p_data is a pointer to your data and data_size is the number of bytes. bit_width is usually set to SPI_BIT_WIDTH_8_BITS (but for RSPI driver you'll need to remove transfer driver in the configurator). When using the framework, there's one additional argument which is the timeout. It's recommended you set it to TX_WAIT_FOREVER so that the function blocks the thread until data is sent/received or an error occurs. If you decide to use the driver only, you'll have to implement a callback function, similar to the one you have for UART, to control the flow of your application (i.e. waiting for p_args->event to be SPI_EVENT_TRANSFER_COMPLETE). Regards
↧