Skip to main content
ctc.ctc
Associate II
January 20, 2017
Question

spi transmit without mcu control

Posted on January 20, 2017 at 06:22

I'm learing stm32 spi,

In normal way of master mode, 

I have to low the slave select pin, then transmit data, then high the slave select pin

I know that I can use dma to transmit data,

but I am not sure that dma can control slave select pin or not?

Can I have anyway to to whole transmit data(including control slave select pin) using all hardware?

#dma #stm32 #spi
This topic has been closed for replies.

4 replies

S.Ma
Principal
January 20, 2017
Posted on January 20, 2017 at 08:56

For Master SPI mode, NSS can be done by SW GPIO, then DMA (TX to send data and generate clocks, RX to receive data) for 1 or multiple blocks of data. This will generate a high throughput with no delay between bytes.

ctc.ctc
ctc.ctcAuthor
Associate II
January 20, 2017
Posted on January 20, 2017 at 11:21

thank you, but one thing I still not sure is that

is there any way to high NSS after dma trasmit finished

(in some situation cpu is too busy, and it's not suitable for using interrupt handler to high NSS)

ST Technical Moderator
January 23, 2017
Posted on January 23, 2017 at 10:51

Hello

ctc.ctc

‌,

Enabled theNSS pulse mode (NSSP=1), this can force the NSS HW to high between data.You may refer to the SPI section in the reference manual related to your device which help you to have more clarification about SPI communication.

Regards

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Keith Folske
Associate II
January 26, 2017
Posted on January 26, 2017 at 02:44

You may want to be careful when using NSS pulse mode.  I had attempted this same thing but found that NSS was pulsed high between the address and data phases of read commands.  This resulted in the slave device being de-selected and therefore not responding to the read because it's address state machine had been reset.