NXP FRDM KW41Z Thread/Bluetooth stack FreeRTOS based

Hi Guys, I am new to FreeRTOS and Thread/Bluetooth. We have an NXP FRDM KW41Z demo module running the thread wireless protocol and bluetooth stacks based on FreeRTOS. We have a requrement where we need to add an SPI interface to communicate with an external device based on the existing application under FreeRTOS . I was wondering if anyone knows of any application notes/turorial/tips/advice to the get SPI communication running. I would be most grateful for any input please. Thanks a lot.

NXP FRDM KW41Z Thread/Bluetooth stack FreeRTOS based

Is this a general SPI question (in which case I would recommend starting with Wikipedia), a question specific to the SPI on the NXP chip (in which case I would recommend the datasheet for the part, or any application notes from NXP), or a question on using a NXP (or other) SPI driver with FreeRTOS?

NXP FRDM KW41Z Thread/Bluetooth stack FreeRTOS based

Hi Richard Thank you so much for getting back to me. Although I am familiar with general SPI operation, we have an NXP FRDM KW41Z SDK as mentioned above and there are references to SPI in the code provided that came with the SDK…I guess my question is, do I need to create my own tasks from scratch to handle SPI communication via FreeRTOS?…e.g. set up a tasks to transmit and receive SPI data? … or are FreeRTOS libraries normally provided to handle serial communications?…if so how do “inform” or “initialise” FreeRTOs to include handling serial communication tasks etc…for example I couldn’t find an interface that allows me to specify SPI protocol parameters (eg number of data bits for example) Thanks a lot

NXP FRDM KW41Z Thread/Bluetooth stack FreeRTOS based

I would not normally create a task specifically to handle serial communication, but call the serial input an output functions (normally provided by the MCU vendor) inline from whichever task needed to perform the IO. I’m sure NXP will have examples of this in their libraries. In an ideal case there would be DMA like facilities on the serial peripheral to handle the transactions for you and just provide you will a buffer of received data. More usually you can handle serial IO transactions in interrupts, so you start the transaction with a function call, then use interrupts generated by the transaction to keep the input/output bytes inputting/outputting until the end of the message, then use an interrupt safe FreeRTOS function to unblock a task that was waiting for the transaction to complete. You can see the examples on the following pages for some ideas: https://www.freertos.org/vTaskNotifyGiveFromISR.html https://www.freertos.org/xStreamBufferSendFromISR.html ( https://www.freertos.org/RTOS-stream-buffer-example.html )

NXP FRDM KW41Z Thread/Bluetooth stack FreeRTOS based

Hi Richard, OK, I will go through the links provided and also have a look at what functions NXP have already implemented. Thanks a lot for your help. Para