SM32F411, SPI slave without NSS still receives data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-09 11:55 PM - edited ‎2023-11-20 5:52 AM
Hi,
I have configured an SPI as receive-only slave in CubeMX and have set NSS to "Hardware input signal":
From logical point of view I now would expect, that there are no SPI data received, as long as NSS stays at high.
However, the CubeMX-generated code still jumps into the SPI-ISR SPI1_IRQHandler() also when NSS is not at LOW.
So my question: what am I doing wrong? How do I have to configure the SPI to respect the NSS/SYNC signal on receiving?
Thanks!
- Labels:
-
SPI
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-10 12:26 AM
Which pin is set as NSS, how exactly is it set in GPIO, and what's its is state?
Generally, read out and check SPI and related GPIO registers content.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-10 12:32 AM
In case of SPI1, the NSS-pin is PA4. But this is not a GPIO-pin, CubeMX deals with it as SPI-NSS-pin where no possibilities exist to have the generic GPIO settings. And within the SPI-settings I can not change any parameters for this pin except than turning NSS on or off ("NSS signal type" is "Input Hardware" as shown in image above).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-10 1:11 AM
How is it connected? Read out its level in GPIO_IDR. Measure voltage directly on the pin. Read our and check SPI registered for other SS-related bits.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-10 2:00 AM
Once again: the NSS-input is NOT an GPIO-pin but a SPI-signal which should be handled by the SPI-hardware! So reading the GPIO-registers for PA4 does not make any sense as the GPI is set to "alternate function" and therefore this register does not reflect the state of the NSS-pin!
The problem is the SPI-hardware not handling the NSS-signal according to what it should do, this SPI-related and has nothing to do with some GPIOs.
In SR-register the flags BSY, OVR (may be because the software is halted in debugger while data transmission is still running), TXE and RXE are set.
