CH32V203 中 CAN 在測試模式中,比如開啟靜默環(huán)回模式。重新進入初始化模式,對寄存器 CAN_BTIMR 的 SILM 和 LBKM 位置0(寄存器置0成功),退出初始化模式,靜默環(huán)回模式依舊存在,需重新上下電才能恢復,請問這是特性嗎?
/*?官方程序?*/ uint8_t?CAN_Init(CAN_TypeDef*?CANx,?CAN_InitTypeDef*?CAN_InitStruct) { ??uint8_t?InitStatus?=?CAN_InitStatus_Failed; ??uint32_t?wait_ack?=?0x00000000; ??CANx->CTLR?&=?(~(uint32_t)CAN_CTLR_SLEEP); ??CANx->CTLR?|=?CAN_CTLR_INRQ?; ??while?(((CANx->STATR?&?CAN_STATR_INAK)?!=?CAN_STATR_INAK)?&&?(wait_ack?!=?INAK_TIMEOUT)) ??{ ????wait_ack++; ??} ??if?((CANx->STATR?&?CAN_STATR_INAK)?!=?CAN_STATR_INAK) ??{ ????InitStatus?=?CAN_InitStatus_Failed; ??} ??else? ??{ ????if?(CAN_InitStruct->CAN_TTCM?==?ENABLE) ????{ ??????CANx->CTLR?|=?CAN_CTLR_TTCM; ????} ????else ????{ ??????CANx->CTLR?&=?~(uint32_t)CAN_CTLR_TTCM; ????} ????if?(CAN_InitStruct->CAN_ABOM?==?ENABLE) ????{ ??????CANx->CTLR?|=?CAN_CTLR_ABOM; ????} ????else ????{ ??????CANx->CTLR?&=?~(uint32_t)CAN_CTLR_ABOM; ????} ????if?(CAN_InitStruct->CAN_AWUM?==?ENABLE) ????{ ??????CANx->CTLR?|=?CAN_CTLR_AWUM; ????} ????else ????{ ??????CANx->CTLR?&=?~(uint32_t)CAN_CTLR_AWUM; ????} ????if?(CAN_InitStruct->CAN_NART?==?ENABLE) ????{ ??????CANx->CTLR?|=?CAN_CTLR_NART; ????} ????else ????{ ??????CANx->CTLR?&=?~(uint32_t)CAN_CTLR_NART; ????} ????if?(CAN_InitStruct->CAN_RFLM?==?ENABLE) ????{ ??????CANx->CTLR?|=?CAN_CTLR_RFLM; ????} ????else ????{ ??????CANx->CTLR?&=?~(uint32_t)CAN_CTLR_RFLM; ????} ????if?(CAN_InitStruct->CAN_TXFP?==?ENABLE) ????{ ??????CANx->CTLR?|=?CAN_CTLR_TXFP; ????} ????else ????{ ??????CANx->CTLR?&=?~(uint32_t)CAN_CTLR_TXFP; ????} ????CANx->BTIMR?=?(uint32_t)((uint32_t)CAN_InitStruct->CAN_Mode?<<?30)?|?\ ????????????????((uint32_t)CAN_InitStruct->CAN_SJW?<<?24)?|?\ ????????????????((uint32_t)CAN_InitStruct->CAN_BS1?<<?16)?|?\ ????????????????((uint32_t)CAN_InitStruct->CAN_BS2?<<?20)?|?\ ????????????????((uint32_t)CAN_InitStruct->CAN_Prescaler?-?1); ????CANx->CTLR?&=?~(uint32_t)CAN_CTLR_INRQ; ????wait_ack?=?0; ????while?(((CANx->STATR?&?CAN_STATR_INAK)?==?CAN_STATR_INAK)?&&?(wait_ack?!=?INAK_TIMEOUT)) ????{ ??????wait_ack++; ????} ????if?((CANx->STATR?&?CAN_STATR_INAK)?==?CAN_STATR_INAK) ????{ ??????InitStatus?=?CAN_InitStatus_Failed; ????} ????else ????{ ??????InitStatus?=?CAN_InitStatus_Success?; ????} ??} ??return?InitStatus; }