各位TI工作人员你们好,我现在使用cc2640的串口,就是官方给的UART.c和UARTCC26XX.c文件,使用回调模式进行读写,将GPS模块的数据读出来再传到电脑上,但是程序泡一会就会死掉,只能传输一个数据,然后就死掉了,也没有广播了,不知道是怎么回事,在社区搜索类似的帖子,有一个人跟我问题差不多但是没有人回复,希望有人解答,谢谢。
这是串口的函数
static void uartRcvDoneCb(UART_Handle uartHandle, void *buf, size_t count)
{
/*if ((*Rev_Buf == '$') && (gps_flag == 0)) //如果收到字符'$',便开始接收
{
rev_start = 1;
rev_stop = 0;
}
if (rev_start == 1) //标志位为1,开始接收
{
rev_buf[num++] = *Rev_Buf; //字符存到数组中
if (*Rev_Buf == '\n') //如果接收到换行
{
rev_buf[num] = '\0';
rev_start = 0;
rev_stop = 1;
gps_flag = 1;
num = 0;
}
}*/
bspUartWrite(rev_buf,1);
bspUartRead(rev_buf,1);
}
void bspUartInit(void)
{
UART_init();
UART_Params_init(&uartParams);
uartParams.baudRate=9600;
uartParams.readCallback = uartRcvDoneCb;
uartParams.readMode = UART_MODE_CALLBACK;
// i2cParams.bitRate = I2C_400kHz;
uartHandle = UART_open(Board_UART, &uartParams);
if (uartHandle == NULL)
{
Task_exit();
}
}
这是simpleBLEperipheral.c中的初始化和读函数
// Register callback with SimpleGATTprofile
SimpleProfile_RegisterAppCBs(&SimpleBLEPeripheral_simpleProfileCBs);
#endif //!FEATURE_OAD
// Start the Device
VOID GAPRole_StartDevice(&SimpleBLEPeripheral_gapRoleCBs);
// Start Bond Manager
VOID GAPBondMgr_Register(&simpleBLEPeripheral_BondMgrCBs);
//bspI2cInit();
//adcvalue=AdcOneShotRead(ADC_COMPB_IN_VDDA3P3V);
bspUartInit();
bspUartRead(rev_buf,1);
extern uint8_t rbuf1[2];
long int t=0;
uchar i,j;
//PINCC26XX_setOutputValue( IOID_9 , 1);
// extern const char num[];
// delay_nms(50) ;
//Init_1621() ;
//HT1621_all_on(16);
// Util_startClock(&periodicClock);
#if defined FEATURE_OAD
#if defined (HAL_IMAGE_A)