cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Slave DMA Communication in Trust zone

Ronak
Associate

Hi,

we are using a stm32u575zit6q Controller. Having a trust zone enable with dual bank support.

our application is to communicate stm32u575zit6q controller to the other MPU with SPI peripheral using DMA.

In this case MPU is behave as a SPI master and stm32u575zit6q is SPI slave.

Master SPI Frequency is 4Mhz.

It is used as fullduplex communications.

This is the SPI Slave Configuration of the stm32u575zit6q.

hspi3.Instance = SPI3;
hspi3.Init.Mode = SPI_MODE_SLAVE;
hspi3.Init.Direction = SPI_DIRECTION_2LINES;
hspi3.Init.DataSize = SPI_DATASIZE_8BIT;
hspi3.Init.CLKPolarity = SPI_POLARITY_HIGH;
hspi3.Init.CLKPhase = SPI_PHASE_2EDGE;
hspi3.Init.NSS = SPI_NSS_SOFT;
hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi3.Init.TIMode = SPI_TIMODE_DISABLE;
hspi3.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi3.Init.CRCPolynomial = 0x7;
hspi3.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
hspi3.Init.NSSPolarity = SPI_NSS_POLARITY_LOW;
hspi3.Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA;
hspi3.Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE;
hspi3.Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE;
hspi3.Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE;
hspi3.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_DISABLE;
hspi3.Init.IOSwap = SPI_IO_SWAP_DISABLE;
hspi3.Init.ReadyMasterManagement = SPI_RDY_MASTER_MANAGEMENT_INTERNALLY;
hspi3.Init.ReadyPolarity = SPI_RDY_POLARITY_HIGH;


For the DMA Configuration I have taken reference of the SPI slave DMA Example.

Master periodically sending a data and Slave receive the data and slave send ACK.

master data receive at slave side but slave transmit is not working.

Can you please help me with trust zone enable SPI slave DMA Example with TX and RX data??

Thanks
Ronak

2 REPLIES 2
FBL
ST Employee

Hello @Ronak and welcome to ST Community 

 

First, make sure that clock edges correspond to the expected data to be captured GPDMA channels are correctly configured. 

Could you explain the behavior: "slave transmit is not working"? Screenshots from debug would be helpful!

Second, to enable secure access for SPI3 you need to enable SPI3SEC and for privileged access SPI3PRIV. For more details, you need to check the reference manual.

Hope this helps! 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!

Hi @FBL ,

Thanks for your response.

SPI peripheral use in non secure zone. So I think not requires a secure access for SPI communication.

Clock edge is same as Master configuration.

Transmit not working means. Slave will provide the response to the master after receiving the data from the master.

Thanks & Regards,
Ronak