[Rev 3] SPI Hardware NSS Pulse config issue
@MasterUser43 is already working on this.
Since Aug 5, 2026.
Assessment
This issue has not been assessed yet.
Description
Version/Project: Flight Computer rev3
Describe the bug
Currently, SPI1 (IMU) and SPI3 (LoRa) are configured in CubeMX to use Hardware NSS management.
Looking at main.c, this results in the following configurations:
hspi.Init.NSS = SPI_NSS_HARD_OUTPUT;hspi.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
Given LoRa and IMU approach to DMA w.r.t. how Chip Select is handled, current .ioc NSS Pulse Mode automatically drives the Chip Select line HIGH for one clock cycle between every single transmitted byte. Respective DMA implementations were intended to follow datasheet guidelines for each developed file:
- The LSM6DSV320X (IMU) datasheet requires CS to be held low for the entire duration of a multi-byte FIFO read.
- The RFM95 (LoRa) datasheet (Page 75) explicitly states: "The NSS pin goes low at the beginning of the frame and stays low between each byte."
Because of this hardware pulsing, we cannot use DMA to burst-read the IMU or LoRa FIFOs. The peripherals will see the CS pulse, assume the transaction was aborted, and return garbage data.
Luckily, this is an easy fix to be implemented/considered during integration phases of drivers. It is simple .ioc edit. Only holding off this personally b/c aforementioned integration concerns.
- Connectivity -> SPI1 and SPI3.
- Change Hardware NSS Signal to
Disable. - In the Pinout View, make physical pins currently assigned to the IMU and LoRa Chip Selects and change them to standard
GPIO_Output. - In System Core -> GPIO, configure these two pins as:
- Output Level: High (to keep the chips off at boot)
- Mode: Output Push Pull
- Pull-up/Pull-down: Pull-up
- Maximum output speed: Very High
This will return Init.NSS to SPI_NSS_SOFT in main.c, allowing driver callbacks (HAL_GPIO_WritePin) to properly hold the Chip Select low during multi-byte DMA transfers.
To Reproduce
Not applicable
Expected behavior
Prevent junk data from false Chip Select config
Screenshots/Pictures/Video
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Points of Contact
@MasterUser43
Add a tag for the component owners, leads, and/or a senior engineer to serve as primary point of contact.
- Dominant language
- C
- Stars
- 8
- Forks
- 6
- Avg merge
- 6d 15h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SunDevilRocketry/Flight-Computer-Firmware
-
enhancement good first issue
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
enhancement good first issue
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
enhancement
SunDevilRocketry/Flight-Computer-Firmware#327 · 1 assignee ·
-
verification
Difficulty 4/5 3-5 days Newbie friendliness 45/100
SunDevilRocketry/Flight-Computer-Firmware#324 · 2 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
All issues in SunDevilRocketry/Flight-Computer-Firmware
Similar issues
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·
-
bug Self Built Image SNAPSHOT Supported Device target/ramips
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100