Part Number: MSP430FR2476
Prepare two MPS430FR2476, each as master/slave
SPI communication (communication with eUSCI_A0) function is under development.
Among them, like [phenomenon], it is a situation where [what you want to do] cannot be realized due to unintended behavior.
Sorry to trouble you, but please answer the following [questions].
【phenomenon】
Immediately after writing data to UCAxTXBUF on the master side, it turn ON not only UCTXIFG but also the "UCRXIFG" bit.
UCRXIFG turns ON even when the communication cable between slaves is disconnected.
[What you want to do]
I want to detect a timeout error when there is no received data for a certain period of time on the master side.
⇒Currently, the received signal arrives immediately after transmission, so it cannot be detected.
【question】
1. Is the above [phenomenon] normal behavior? If there is an error, is there a workaround?
2. Is it possible to realize [what you want to do]? If so, do you have any sample code?
【detail】
The master/slave performs the following processing.
Master: Executes the following processes at 1ms intervals.
① Data transmission EUSCI_A_SPI_transmitData(EUSCI_A0_BASE, tx_data);
② Wait for BUSY OFF while(EUSCI_A_SPI_isBusy(EUSCI_A0_BASE));
③ Check the reception flag while(!EUSCI_A_SPI_getInterruptStatus(EUSCI_A0_BASE, EUSCI_A_SPI_RECEIVE_INTERRUPT));
④ Data reception *rx_data = EUSCI_A_SPI_receiveData(EUSCI_A0_BASE);
Slave: Perform the following processing at the UCRXIFG interrupt.
① Data transmission EUSCI_A_SPI_transmitData(EUSCI_A0_BASE, tx_data);
② Wait for BUSY OFF while(EUSCI_A_SPI_isBusy(EUSCI_A0_BASE));
③ Reception flag check while(!EUSCI_A_SPI_getInterruptStatus(EUSCI_A0_BASE, EUSCI_A_SPI_RECEIVE_INTERRUPT));
④ Data reception *rx_data = EUSCI_A_SPI_receiveData(EUSCI_A0_BASE);
[Register setting]
| Offset | Acronym | Master | Slave |
| 00h | UCAxCTLW0 | 0x6B82 | 0x6302 |
| 00h | UCAxCTL1 | 0x03 | 0x03 |
| 01h | UCAxCTL0 | 0x00 | 0x00 |
| 06h | UCAxBRW | 0x02 | 0x00 |
| 06h | UCAxBR0 | 0x02 | 0x00 |
| 07h | UCAxBR1 | 0x00 | 0x00 |
| 0Ah | UCAxSTATW | 0x0000 | 0x0000 |
| 0Ch | UCAxRXBUF | 0x**** | 0x**** |
| 0Eh | UCAxTXBUF | 0x**** | 0x**** |
| 1Ah | UCAxIE | 0x0000 | 0x0001 |
| 1Ch | UCAxIFG | 0x000x | 0x000x |
| 1Eh | UCAxIV | 0x0000 |
0x0002 |
Best regards.