cancel
Showing results for 
Search instead for 
Did you mean: 

SPI NSS/CS when working with registers and DMA

ProxiVision
Associate II

Hello,

 

i've been trying to get SPI working in conjunction in DMA.

But with "bare metal register implementation" i can't even get the NSS working properly.

 

The Stm32F730 needs to hold NSS/Chip Select high all the time, except for when communicating with the ADS8910b (18Bit SAR ADC) via SPI, so that the ADC is able to send the Interrupt to the F7 to initiate SPI communication.

Using HAL library functions (HAL_SPI_Transmit etc.) is not an option since it's way to slow and with the special 22-Bit frame of the ADC it seems like the commands are not interpreted correctly.

 

In the ref manual (see attached) from page 998 onwards it's stated that the SSI & SSM Bits (8&9 in SPIx_CR1 register) are used for the NSS software control.

Bit 9 (SSM) enables the software management of the NSS Pin.

Bit 8 (SSI) is the value that will be forced onto the NSS Pin, if the management is enabled.

 

I write both bits to 1 - but the NSS stays low.

 

The SSOE bit in CR2 is set to 1, but like it's stated there, it can only be either 0=disabled or 1=enabled in master mode and when the SPI interface is enabled.

 

Since i need to reconfigure DMA i need to disable & re-enable SPI & DMA between transfers (i cannot use the circular mode, so i always have to refresh the memory target adress etc.) i tried out the pin stacking option in the device configuration tab. I configured the NSS Pin as GPIO output and set its value to 1 manually, as well as configuring it with a pull-up. - Not working either, NSS stays low.

 

When i first wrote the code, i used the HAL library (HAL_SPI_Transmit...) and drove the NSS pin manually, the software management was disabled and the NSS was just a GPIO.

 

How can i get NSS working the way i need it to ? (pulled high except for communication frames)

2 REPLIES 2

Possibly you should focus first on just getting control of a GPIO.  If you've taken the bare-metal path without the HAL does anything work?

Is this already-designed hardware?

Why can you not use circular mode?  What's your sample rate?

I don't do everything bare-metal, only the time-critical parts.

 

The rest of the code works fine as far as i can see it, i use a couple other interfaces, some stuff with HAL, some without (GPIO's generally without).

The GPIO on the CS only doesn't work in pin stacking mode, when SPI is configured on the same pins.

Yes, the prototypes are at my desk.

 

I can't use the circular mode since i have an analogue circuit running a precisely timed sequence after which the ADC interrupts the F7 to signal that the data is ready. Maximum sample rate is at 1MSa.