I only receive datas from UART by interrupt.
a. Initialize UART
void scc_init(void) { PERCFG &= ~(1 << 0); P0SEL |= (1 << 2) | (1 << 3); U0CSR |= (1 << 7); U0GCR |= 11; U0BAUD |= 216; UTX0IF = 0; URX0IF = 0; U0CSR |= (1 << 6); URX0IE = 1; EA = 1; this_rxbuf_wi = 0; }
b. Receive datas
HAL_ISR_FUNCTION(this_urx0_isr, URX0_VECTOR) { HAL_ENTER_ISR(); URX0IF = 0; this_rxbuf[this_rxbuf_wi] = U0DBUF; if(++this_rxbuf_wi >= THIS_RXBUF_SIZE){ this_rxbuf_wi = 0; } HAL_EXIT_ISR(); }
Always lose data when testing, for example
a. I send [aa bb 0a 03 12 48 10 f3 7b 98 0d 0a] from PC
b. But only received [AA BB 03 48 F3 0D 0D 0A] at this_rxbuf on CC254X
Is there any wrong? Thanks!