I'm experiencing some strange behaviour when trying to communicate as SPI master via LPSPI on a i.MXRT 1062 MCU, when making use of continuous transfer commands (TCR.CONT and TCR.CONTC set) combined with TCR.TXMSK.
The communication sequence desired:
This means for implementation (pseudo code; of course, the command word ist prepared and then written to TCR in an atomic way):
Unexpectedly, after the second TCR access (step 3), the transfer is starting immediately, but doesn't stop after 32 SPI clocks, but keeps on clocking endlessly (clearly reproducible with CR.DBGEN set, executing until step 3, and halting after the TCR write access).
Subsequently, the RX-FIFO does overrun, even though CFGR1.NOSTALL is not set (meaning, the transfer should stall when the receive FIFO is full).
The issue does not seem to occur, if
For me this looks like a LPSPI issue. However I could not find any hint in the RM, or in the chip errata.
Is there any better solution instead of the workaround?
Hello @Mysterion,
did you ever find a solution to that problem?
I currently have the same problem but a bit worse: I want to use QSPI and therefore have to set TXMSK. Therefore I can't use the workaround to push one dummy byte to the TDR for each data that should be read. Due to some errata on the i.MXRT1050 related to TXMSK and TCR, I also can't just push the next TCR into the FIFO. ERR011097 tells that the FIFO should be empty before pushing another TCR if TXMSK is set. ERR050607 tells that I have to either wait for the transfer to be complete or I have to split a transfer into multiple commands. Together with the endless transmission that you describe, I haven't yet found a method to fulfill all these requirements without a lot of polling and hoping that I get the timing right.
Best regards
Christian
I think I just found my answer: NXP has a application note for the LPSPI on KL28Z. There is a paragraph regarding that problem:
3.3.4. 4-bit dummy operation in continuous mode
If use dummy operation in continuous mode, need to pay attention, LPSPI would not stop after the
frame length specified in TCR is sent out. So, for 4-bit dummy operation, continuous mode is not
recommended. So, to implement 4-bit operation, need to work in non-continuous mode and implement
CS by GPIO mode.
Dummy mode in this case is a transfer with RXMSK and TXMSK set. I assume it's the same for the LPSPI on i.MXRT1050 and only TXMSK set. Seems that the LPSPI module is just broken and can't handle the CS pins like expected.
@Mysterion: Sorry for bothering you. Should have searched a bit more before replying to your old post.