This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/RM48L952: RTOS task timing

Part Number: RM48L952

Tool/software: TI-RTOS

Hello,

I am currently developing an RTOS based program which configures SPI ports 1 and 2 to communicate with one another: SPI1 as the master and SPI2 as the slave. I currently only have one task dealing with the setup of the SPI registers:

Current task

I would like to split this task into two separate tasks: Task1 would initiate SPI2 and Task2 would intiate SPI1. Do I have to worry about synchronizing the tasks at all? Or can I just simply put them each into different tasks without any other concerns?

Calvin

  • Unless you use the SPInENA pin, you need to make sure the slave device is initialized first. You don't want to run the SPI2 routine again until all the data has been transferred so it makes more sense to me to keep it in one task. However, I don't know what your big picture is. What do you really want to do when you get all of your code working?
  • In the long run, I want my program to pull data in from 3 ADCs using (potentially) three SPI ports. I will have two buffers: the data coming in from the SPI port(s) will be shoved into one buffer (most likely separated using parity), and I will switch to the other buffer when the first one is full. At this moment, the currently full buffer will have it's data pushed out to a uSD card. That (for the most part) is the bigger picture that I'm looking at. For now, I was just trying to gain a better understanding of how tasks coordinated with each other (which led to the experiment involving the two task setup for SPI ports 1 and 2). I am not currently using the nENA pin for SPI1, but for SPI2 I have the nENA pin configured as a CS pin instead.
  • Ok, in the final application you do not need to worry about setting up a slave SPI since the ADC's will be the slaves. For now I suggest you just keep the master and slave in the same task. Putting the spiSendAndGetData() function for the slave in a separate task will not work because then that function would get called repeatedly while the polling function spiTransmitAndReceive() function.
  • Sounds good. Also I just wanted to take some time to thank you. You have been a huge help with helping me understand this process as I go through it. So thank you!