Other Parts Discussed in Thread: CC2640
Hi everyone,
I'm trying to apply a uart communication between two CC2640 chipsets. Due to the power management requirement, I applied two handshake pins whose function is very similar to the ones in TI's protocol.
In my program, I set a CC2640 to call uart_read after recieve MRDY_ENABLE and set SRDY_ENABLE to inform the other chipset to start transmission. However, it always goes to cpu exception. I'm pretty sure that it is caused by uart_read() because it would be alright if I comment uart_read(). In addition, I checked CFSR register, and IMPRECISERR=1 when error occurs.
here is my code:
if(!PIN_getInputValue(MRDY_PIN) && UART_WRTing_FLAG==0){
NPITL_setPM();
ICall_CSState key;
key = ICall_enterCriticalSection();
if (UART_RDing_FLAG==0){
Myindicator =UART_read(SbpUartHandle, &MyUARTRxBuf, 18);
UART_RDing_FLAG=1;
}
ICall_leaveCriticalSection(key);
SRDY_ENABLE();
}
I opened the UART when the task initiaized. About NPITL_setPM(), I just copied the function from npi_tl.c which could prevent chipset from sleeping.
Actually, if there is no data recieved from UART before timeout, the error would not occur, but if there is, the program would go to the infinite loop:
0x1001bbd6: 0x2a00 CMP R2, #0
0x1001bbd8: 0xd0fd BEQ.N 0x1001bbd6
Does anyone know how to prevent this or anything wrong in my code?
Regards,
Kai