2013-01-30 06:02 AM
I am relatively new to the STM32 series. My project has a custom board with a STM32F102C6. I have 2 boards. My first board I have been developing on and everything is working fine. On the 2nd board, the program gets stuck waiting for the first spi transmission to complete:
SPI_I2S_SendData(SPI1, bRelayStatus[i]); // send data
while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET); // wait for completion
SPI_I2S_ReceiveData(SPI1); // get dummy byte from rx buffer
If I comment this line out (wait for completion), the rest of the program runs fine. I do not see any outgoing clock pulses on the spi port, so it seems as if it is not being clocked. I did enable the clock to the port and everything works fine on the other board. Occassionally, I can power the 2nd board up and it runs, but never with the debugger.
Any ideas?
2013-01-30 07:03 AM
I think I have solved this. For anyone else who might run into this issue, it appears to be related to setting the NSS to hardware. On my 2nd board, the spi devices were not fully populated. From reading the datasheet, this can cause a spi fault state and put it into slave mode. Changing the NSS setting to slave seems to have fixed the problem.