I have a system with 1 STM32F407 and 3 STM32F401. The 407 is the master of a communication with SPI with the 3 slaves. On the slave a use SPI in slave mode with DMA in RX/TX. On the slaves the input NSS is used in hardware mode. I have of course three GPIO on master which allow to select one slave after each other. When I try to ask a slave I receive it answer BUT all the three slave answer at the same time. It's like the slave do not take into account the NSS pin.
I have configured the system with STMCube.
I use the HAL library.
/* SPI2 init function */
hspi2.Instance = SPI2;
hspi2.Init.Mode = SPI_MODE_SLAVE;
hspi2.Init.Direction = SPI_DIRECTION_2LINES;
hspi2.Init.DataSize = SPI_DATASIZE_8BIT;
hspi2.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi2.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi2.Init.NSS = SPI_NSS_HARD_INPUT;
hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi2.Init.TIMode = SPI_TIMODE_DISABLED;
hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;
hspi2.Init.CRCPolynomial = 10;
/* DMA controller clock enable */
/* DMA interrupt init */
HAL_NVIC_SetPriority(DMA1_Stream3_IRQn, 0, 0);
HAL_NVIC_SetPriority(DMA1_Stream4_IRQn, 0, 0);
HAL_SPI_TransmitReceive_DMA(&SPI_HMI,(uint8_t *)&txAxisBuffer,(uint8_t *)&rxAxisBuffer,20);
Has someone a solution for me?
Thank you in advance.