问答

汇集网友智慧,解决技术难题

ltfy

TA的家园币:22  

  • gd32c103 can收发一段时间出现异常,请教如何解决?

    gd32c103can使用,单总线上有其他节点,其他节点会间隔发数据,发现C103只接收没问题,但是一发数据,过后就会出现异常(离线、总线错误什么的),收不到其他节点的数据了,除非使能了离线自动恢复会自己恢复,想请教一下这个是什么问题,如何解决,还是我配置不对,懂的大佬帮忙看看,配置如下:voidCAN0_Init(void){/*enableCANclock*/rcu_periph_clock_enable(RCU_CAN0);rcu_periph_clock_enable(RCU_GPIOB);rcu_periph_clock_enable(RCU_AF);/*configureCAN1GPIO*/gpio_init(GPIOB,GPIO_MODE_IPU,GPIO_OSPEED_50MHZ,GPIO_PIN_8);gpio_init(GPIOB,GPIO_MODE_AF_PP,GPIO_OSPEED_50MHZ,GPIO_PIN_9);gpio_pin_remap_config(GPIO_CAN0_PARTIAL_REMAP,ENABLE);can0_networking_init();/*configureCAN0NVIC*/nvic_irq_enable(CAN0_RX0_IRQn,0,2);/*enableCANreceiveFIFO0notemptyinterrupt*/can_interrupt_enable(CAN0,CAN_INT_RFNE0);}voidcan0_networking_init(void){can_parameter_structcan_parameter;can_struct_para_init(CAN_INIT_STRUCT,&can_parameter);/*initializeCANregister*/can_deinit(CAN0);/*initializeCAN*/can_parameter.time_triggered=DISABLE;//时间触发通信模式can_parameter.auto_bus_off_recovery=DISABLE;//离线自动恢复can_parameter.auto_wake_up=DISABLE;//自动唤醒can_parameter.auto_retrans=ENABLE;//自动重发can_parameter.rec_fifo_overwrite=ENABLE;//接收FIFO满时覆盖can_parameter.trans_fifo_order=ENABLE;//发送FIFO顺序can_parameter.working_mode=CAN_NORMAL_MODE;//can_parameter.resync_jump_width=CAN_BT_SJW_1TQ;//can_parameter.time_segment_1=CAN_BT_BS1_6TQ;//can_parameter.time_segment_2=CAN_BT_BS2_3TQ;can_init(CAN0,&can_parameter);/*configCAN0baudrate*/can_frequency_set(CAN0,250000);can_filter_mask_mode_init(DEV_CAN0_ID,DEV_CAN0_MASK,CAN_EXTENDED_FIFO0

    PA ar pi TE GD32C103 CAN收发

    2022-11-01 11