Must I implement the read of the CS signal to receive data in a SPI slave?
Hi,
project details:
- master: FPGA zynq board, clk freq = 25MHz
- slave: STM32F411VE board, pull up in CS
- full duplex tx/rx in both boards
- slave code generated with cubemx
- sw4stm32 IDE
- 20cm jumper cables to connect both boards
- GND connection beteween the boards
I have understand that in the master (I am using a FPGA) I must select low or high the CS to select the slave (STM32F411VE board), but what about the slave?, do I need to implement something like this to receive the data?
//first way
while(1)
{
if (HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_1) == 0) //CS pin
{
HAL_SPI_TransmitReceive(&hspi5,txbuffer,rxbuffer, 12, 5000);
}
}or the function transmitreceive detects internally if the CS is low to start the communication?, I mean, receive the data just doing this:
//second way
while(1)
{
HAL_SPI_TransmitReceive(&hspi5,txbuffer,rxbuffer, 12, 5000);
}I have this query because I am doing tests (second way) in the slave but always receive data when I connect the CS pin to GND or 3.3V, and in the TransmitReceive function I dont´t find any line of code that checks if CS is enabled or disabled to start the tx/rx of data
thanks
