您好, 我使用STM32F103 48pin , PA11 PA12為USB(使用HID) , PB8 PB9為CAN, 當USB接上時會找到USB裝置,執行CAN傳送,結果USB會斷掉(電腦的裝置管理員顯示錯誤), 而且產生死機現象(一直中斷USB_LP_CAN_RX0_IRQHandler()) CAN1_Init(); RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN, DISABLE); USB_Cable = 1; USB_Port_Init(); if(KEY1 == 0) { USB_Cable_Config(DISABLE); CAN_Write(); Dly10ms(); USB_Cable_Config(ENABLE); } void CAN1_Init(void) { NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN_RX0_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); CAN_DeInit(); CAN_StructInit(&CAN_InitStructure); CAN_InitStructure.CAN_TTCM = DISABLE; CAN_InitStructure.CAN_ABOM = ENABLE; CAN_InitStructure.CAN_AWUM = DISABLE; CAN_InitStructure.CAN_NART = DISABLE; CAN_InitStructure.CAN_RFLM = DISABLE; CAN_InitStructure.CAN_TXFP = ENABLE; CAN_InitStructure.CAN_Mode = CAN_Mode_Normal; CAN_InitStructure.CAN_SJW = CAN_SJW_1tq; CAN_InitStructure.CAN_BS1 = CAN_BS1_3tq; CAN_InitStructure.CAN_BS2 = CAN_BS2_5tq; CAN_InitStructure.CAN_Prescaler = 4; CAN_Init(&CAN_InitStructure); CAN_FilterInitStructure.CAN_FilterNumber = 0; CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask; CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit; CAN_FilterInitStructure.CAN_FilterIdHigh=((MAIN_CAN_ID16; CAN_FilterInitStructure.CAN_FilterIdLow=((MAIN_CAN_ID |
stm32 USB的CDC类传输掉数据
【MCU实战经验】基于STM32F103C8T6的hart总线调试器设计
求教STM32F103进入STOP模式后用外部中断唤醒的问题
基于STM32F103RCT6的无源蜂鸣器音乐播放(生日快乐歌)
STM32F103c8t6有没有DAC 功能?
STM32F103x中文数据手册
新手求教,为何在我电脑上找不到STM32F1Xx.h文件
金龙107例程汇总(STM32F107)
万利STM32F107VC 原理图
STM32F103 ADC多通道检测必须要DMA吗?
RE:STM32F103 USB CAN 使用【悬赏问答】
RE:STM32F103 USB CAN 使用【悬赏问答】
RE:STM32F103 USB CAN 使用【悬赏问答】
RE:STM32F103 USB CAN 使用【悬赏问答】