ESP32-S2: SPI documentation ambiguities
Posted: Mon Mar 28, 2022 11:35 pm
Hi,
I am trying to use the ESP32-S2 SPI3 unit for a bit of an odd application, and I *think* it can do what I need. However, there are a few things in the technical manual that are very much not clear, and I would love to get some clarifications.
I was planning to use segmented DMA for my application. These are the corner cases that I cannot really figure out:
1. In full-duplex mode, what happens if SPI_USR_MOSI_DBITLEN and SPI_USR_MISO_DBITLEN differ? This is relevant because sometimes my application will have data flowing full duplex, and sometimes not... and it would be annoying to have to allocate memory that will be just thrown out.
2. What are the semantics of SPI_Q_POL? If one sets SPI_Q_POL = 0 and SPI_USR_MOSI = 0, will MOSI contain all zeroes?
3. Similarly, if SPI_USR_MISO = 0. is input discarded as opposed to send to DMA or the buffer registers?
4. For (2) and (3), does setting either of those bits also require SPI_DOUTDIN = 0?
5. If SPI_CSx_DIS = 1, what is the signal present on the CS# output pin?
6. Can an unused DMA descriptor be empty (size = length = 0), or does that require the descriptor to be skipped over in the linked list?
7. When *_DBITLEN+1 is *not* a multiple of 8, does that mean that the remaining bits are left in a FIFO somewhere and that a subsequent transaction can continue where it left off in the bitstream (the TRM seems to imply it, but it isn't clear if that applies only to whole bytes or not), or are any such fractional bytes discarded/zero-padded/filled with garbage?
8. What are one expected to put into SPI_CONF_BITLEN? The TRM says to "pay attention to it", but at least I cannot find any description of what values one can put there (specifically, what value would represent the minimum latency?)
Many thanks,
-hpa
I am trying to use the ESP32-S2 SPI3 unit for a bit of an odd application, and I *think* it can do what I need. However, there are a few things in the technical manual that are very much not clear, and I would love to get some clarifications.
I was planning to use segmented DMA for my application. These are the corner cases that I cannot really figure out:
1. In full-duplex mode, what happens if SPI_USR_MOSI_DBITLEN and SPI_USR_MISO_DBITLEN differ? This is relevant because sometimes my application will have data flowing full duplex, and sometimes not... and it would be annoying to have to allocate memory that will be just thrown out.
2. What are the semantics of SPI_Q_POL? If one sets SPI_Q_POL = 0 and SPI_USR_MOSI = 0, will MOSI contain all zeroes?
3. Similarly, if SPI_USR_MISO = 0. is input discarded as opposed to send to DMA or the buffer registers?
4. For (2) and (3), does setting either of those bits also require SPI_DOUTDIN = 0?
5. If SPI_CSx_DIS = 1, what is the signal present on the CS# output pin?
6. Can an unused DMA descriptor be empty (size = length = 0), or does that require the descriptor to be skipped over in the linked list?
7. When *_DBITLEN+1 is *not* a multiple of 8, does that mean that the remaining bits are left in a FIFO somewhere and that a subsequent transaction can continue where it left off in the bitstream (the TRM seems to imply it, but it isn't clear if that applies only to whole bytes or not), or are any such fractional bytes discarded/zero-padded/filled with garbage?
8. What are one expected to put into SPI_CONF_BITLEN? The TRM says to "pay attention to it", but at least I cannot find any description of what values one can put there (specifically, what value would represent the minimum latency?)
Many thanks,
-hpa