AnsweredAssumed Answered

nSS is missing in action, using HAL with stm32F767 to do SPI master multiple byte frame, sending using DMA...

Question asked by julian on May 8, 2018
Latest reply on May 22, 2018 by yang deamon

Hey there,

 

 

I'm using SPI3 on an STM32F767ZI (on a nucleo board for now) 

I'm using HAL and DMA based multi-byte transfer. (but still feel kind of new to it) I'm trying to just setup a basic SPI master and wanted to be able to use the nSS signal...  What I want to do for this peripheral, is have the nSS go down (assert) at the start of a data frame, and then have it stay down till the end, then pop up (deassert) when finished.
so I setup nSS as a hardware output in cubemx, and generated the code. 

When I call  HAL_SPI_TransmitReceive_DMA(...) I get no nSS action. (though clock and dummy data frame go perfectly)


I tried the same thing with SPI2 with the same settings, and had the same results... But SPI2 has an option called nSS pulse mode, and when I tried enabling that it automatically generates nSS transition to deasserted then asserted every 8 bits... And when disabled the nSS stays down all the time, just like with SPI3... 

 

I have tried taking the nSS pin back to a GPIO, and then manually asserting that GPIO nSS signal at the start of a transmission, then using HAL_SPI_TxRxCpltCallback() to toggle the GPIO pin back at the end of my data frame, but at 6MHz SPI rate for just a few bytes in a frame, I'm spending more time at the end of my SPI frame waiting for nSS to deassert than the entire frame takes!

 

Anyway - this could be a noob error, I am new to HAL and I may be approaching this wrong - but I'd really love a way to be able to have nSS do gown for a multiple byte DMA frame, and then pop right back up again straight after the last bit... can anyone suggest anything that might help? 

Outcomes