Concurrent SPI Sensor Readings Using PPI and Timer

Hi everyone,

I'm working on a project where I have four sensors connected to my chip via two SPI buses ( 2 on each with 4 CS). My goal is to read data from these sensors as concurrently as possible to ensure minimal latency. The idea is to read two sensors at the same time (using both SPI buses) and then immediately read the remaining two sensors afterwards.

My Questions:

  1. Triggering Sequential Reads: I'm a bit unsure about how to configure the PPI channels to trigger the second set of SPI reads immediately after the first( With the toggling of the CS Pins inbetween). Because if i just connect the end event of the Spi Read to the start task it would loop forever. My goal is to complete the first two sensor readings concurrently and then move on to the next two without delay. Then wait for the next timer event before starting the next round of reads.

  2. Associating Data to Sensors: Since I'm reading 4 sensors but only have two RX buffers, how should I correctly associate the data to the corresponding sensors? What's the best way to manage or distinguish the data coming from the four sensors?

Any guidance on setting this up would be greatly appreciated!
Thanks in advance!

Parents
  • Hi,

    Triggering Sequential Reads: I'm a bit unsure about how to configure the PPI channels to trigger the second set of SPI reads immediately after the first( With the toggling of the CS Pins inbetween). Because if i just connect the end event of the Spi Read to the start task it would loop forever. My goal is to complete the first two sensor readings concurrently and then move on to the next two without delay. Then wait for the next timer event before starting the next round of reads.

    This isn't a trivial task, and the fact that you have to toggle the correct CS pin between the transaction makes it much more complex if you want to do it mostly through PPI.

    In essence, you should start with only 1 SPI bus with two slaves and verify that it works before adding the second SPI bus. Since the second set would just be a matter of copying the first set but using different instances.

    I know you have stated that you want to do this with minimal latency, but would it be an option to involve the CPU more by using the SPIM callback handler to reconfigure the SPIM with correct buffer and CS pin between each transaction?

    regards

    Jared 

Reply
  • Hi,

    Triggering Sequential Reads: I'm a bit unsure about how to configure the PPI channels to trigger the second set of SPI reads immediately after the first( With the toggling of the CS Pins inbetween). Because if i just connect the end event of the Spi Read to the start task it would loop forever. My goal is to complete the first two sensor readings concurrently and then move on to the next two without delay. Then wait for the next timer event before starting the next round of reads.

    This isn't a trivial task, and the fact that you have to toggle the correct CS pin between the transaction makes it much more complex if you want to do it mostly through PPI.

    In essence, you should start with only 1 SPI bus with two slaves and verify that it works before adding the second SPI bus. Since the second set would just be a matter of copying the first set but using different instances.

    I know you have stated that you want to do this with minimal latency, but would it be an option to involve the CPU more by using the SPIM callback handler to reconfigure the SPIM with correct buffer and CS pin between each transaction?

    regards

    Jared 

Children
No Data
Related