multi master spi
Hey everyone,
I've been struggling with the multi-master spi. I can send and receive seperately but when I try to integrate it into one program it bogs out. My understanding is that I can set the SPI line as a slave and then whenever I want it to act as master, I need to manually toggle a secondary GPIO PIN to act as the cs line and call HAL_SPI_Transmit_DMA.
This is the configuration I have going for the SPI line as slave:
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_SLAVE;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_HARD_INPUT;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 7;
hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
hspi1.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;This works well for the slave line, but doing the cs line toggle and sending a transmit doesn't work. Is my approach correct?
Thanks in advance for any help!