使用默認的9600時沒有問題,但是覺得速度慢,想改成19200,但是一改就收不到東西,請各位指教以下。使用的芯片是STM32,串口是USART2 xWriteCH375Cmd(CMD_SET_BAUDRATE); xWriteCH375Data(0x02); //分頻系數(shù) xWriteCH375Data(0xD9); //分頻常數(shù)
USART2->CR1 &= ((u16)0xDFFF);//CR1_UE_Reset; USART2->BRR = 0x753; USART2->CR1 &= ((u16)0x2000);//CR1_UE_Set;
DelaymS(5); USART2->SR = (u16)~USART_FLAG_RXNE; USART2->SR = (u16)~USART_FLAG_TXE; USART2->SR = (u16)~USART_FLAG_TC;
USART_SendStr(USART1, "start\n");
DelaymS( 200 ); /* 有些USB設(shè)備要等待數(shù)百毫秒才能正常工作 */ USART_SendStr(USART1, "lib init\n"); i = CH375LibInit( ); /* 初始化CH375程序庫和CH375芯片,操作成功返回0 */ mStopIfError( i );