4 devices on one LPSPI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

4 devices on one LPSPI

Jump to solution
445 Views
Gevroy
Contributor I

Hello,

I use the i.MX RT1064 and would like to connect 4 devices to 1 LPSPI port (the other SPI ports are all in use) and all 4 of these devices are connected to their own PCS. We want to read the data via master mode eDMA.

Is there a possibility to set the LPSPI in such a way that it can switch between the different PCS (PCS0 to PCS3) automatically or via eDMA?

Best Regards,

Roy

Labels (1)
0 Kudos
1 Solution
398 Views
MultipleMonomials
Contributor III

To add to this, it is possible to have one DMA transaction write to the TCR register, then trigger another DMA transaction which does the SPI transfer to the desired chip.  You can even, then, have the 2nd SPI transaction chain to another TCR write and another SPI transfer.  One way to do this is by using the channel-to-channel linking feature (CSR.MAJORELINK in the DMA descriptor) to cause one DMA channel to trigger the next DMA channel when it completes processing.  Another way is to use the linked list/scatter-gather feature (CSR.ESG in the DMA descriptor).  This causes a single DMA channel to iterate through a chain of DMA descriptors in memory.

View solution in original post

3 Replies
419 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

You can configure TCR[PCS] field before the transfer to set which PCS is LPSPI going to use, you need to manually switch it before the transfer.
The other way is to set CS as GPIO and manually assert them.

Best regards,
Omar

0 Kudos
399 Views
MultipleMonomials
Contributor III

To add to this, it is possible to have one DMA transaction write to the TCR register, then trigger another DMA transaction which does the SPI transfer to the desired chip.  You can even, then, have the 2nd SPI transaction chain to another TCR write and another SPI transfer.  One way to do this is by using the channel-to-channel linking feature (CSR.MAJORELINK in the DMA descriptor) to cause one DMA channel to trigger the next DMA channel when it completes processing.  Another way is to use the linked list/scatter-gather feature (CSR.ESG in the DMA descriptor).  This causes a single DMA channel to iterate through a chain of DMA descriptors in memory.

349 Views
Gevroy
Contributor I

Thanks for your suggetion. I used the linked list/scatter-gather function. First I write the TCR register with the PCS to start. I then used a list of DMA discriptors to read the connected chip, rewrite the TCR with the new PCS value setting, read the connected chip, etc. It works perfectly and we can use the four connected chips read on the LPSPI port with one DMA request.

0 Kudos