2014-03-24 03:47 AM
Hello everybody,
I am trying to interface two STM32F3 boards with SPI port in full duplex with interruption.
One board acts as Master and the other one as a Slave. The Master sends a command, then the 4 Byte from TxBuffer. When the slave receives this command, it enables the transmission buffer interrupt to send an ACK, then a4 Byte from TxBuffer.
The problem is that the 4 Bytes sent by the slave, i received only 2 Bytes. My BaudRate set up is : SPI_BaudRatePrescaler_8;If i slow down this by putting : SPI_BaudRatePrescaler_256; i can receive 3 Bytes You find enclosed the code written for the Master and the Slave. Thanks in advance of any help.
2014-03-24 02:10 PM
No idea what would be the problem ?
Please, i need an answer to continue my work . Thanks2014-03-24 02:50 PM
The code is frustratingly incomplete, but doesn't RXNE trail TXE, what's the consequence of disabling the TXE interrupt?
2014-03-27 09:16 AM
Thank you clive1 for your response.
I have updated my code. In the SPISlave.c, i have created two functions SPI_Receive()(receive data from the Master) and SPI_Send()(send data to the master). These routines are called in a Main function depending if i want to receive or send. The SPI_Receive() receives data from the SPI master with no problem. But when i want to send data to the master using the SPI_Send(), i can't get data in the SPI master side. In both SPIMaster.c and SPISlave.c, you can find how the SPI1_IRQHandler() that makes the treatment. Thanks in advance for helping. ________________ Attachments : SPIMaster.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzat&d=%2Fa%2F0X0000000bOB%2FtKDDztvh.NWX_LeGPeAYa991LdrsrMNOkrNm1ro5Tjw&asPdf=falseSPISlave.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzao&d=%2Fa%2F0X0000000bOC%2FKB2.NyR3WjMS1g_121A_iSx7W5_PcFaSf20_H3YUWnU&asPdf=false