Replies: 3 comments 5 replies
-
SPISlave isn't capable of doing that, no. In general, because SPI has no handshaking and interrupts are unpredictable, it preloads response data into the HW FIFO as you saw. That way there is no/very little CPU limitation on responding properly. Theoretically you could twiddle the HW directly (maybe set core1 up doing nothing but polling the SPI block?) but even with that, I doubt you'd be able to get a 0-bit turnaround (i.e. 8 bits command in changes bit 9 of the output like in your message). The HW block itself will have a shift register that will probably be loaded w/the next 8-bits at the same time as the last 8-bit is sampled from input. |
Beta Was this translation helpful? Give feedback.
-
I do not need 0-byte turnaround. I need to implement something like:
But for now I could not react on the previous byte. But only on the byte that was put to the FIFO 8 bytes ago. So, I need some way to disable FIFO or to make it's depth 1 instead of 8. |
Beta Was this translation helpful? Give feedback.
-
Ultimately, my question is related to the minimal SPI transfer size which your library suppose to handle. I achieve the proper communication with SPI transfer size from 8 bytes amd higher. But for less then 8 bytes it does not work properly for me. Is it possible to achieve stable communication with the SPI transfer 1 byte per each transer?
…________________________________
From: Earle F. Philhower, III ***@***.***>
Sent: Sunday, August 4, 2024 11:17:02 PM
To: earlephilhower/arduino-pico ***@***.***>
Cc: chelyuk ***@***.***>; Author ***@***.***>
Subject: Re: [earlephilhower/arduino-pico] SPISlave getting data without shift on the FIFO queue depth (Discussion #2316)
Err, I really don't see what you're doing, sorry. If you're loading 8 bytes of 0 into the SPI FIFO then of course things will be 8 bytes delayed, no? A single dummy byte in the FIFO is all it seems you'd need in your comms case (i.e. since the 1st command in write will simultaneously read out dummy data). SPISlave, and the SPI slave HW block, will not clear the FIFO between transactions.
—
Reply to this email directly, view it on GitHub<#2316 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AG5IHYADMKL6JFYCCGJ2SKLZP2D35AVCNFSM6AAAAABL67S4WWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMRTGY4DGMY>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I need to create a program for SPI slave which should send response appropriately depends on receive bytes.
I am using the following approach:
But at first master got 8 dummies and only then starting the communication with the 8 bytes shift.
As far as I understand I need to disable the bit TXMIS for SPI: SSPMIS Register (Datasheet p. 521)
Could you advise is it possible with SPISlave library?
Or what is proper way with SPISlave to achieve response with 1 byte delay and not with the whole FIFO queue depth?
Beta Was this translation helpful? Give feedback.
All reactions