STM32H7B0 CAN发送异常 0X210100 = hfdcan1.Instance->TXFQS /*!< FDCAN Tx Event FIFO Status register, */ 0X200 = hfdcan1.ErrorCode /*!< FDCAN Error code */ 每次上电能正常发送10多次就不能发了 故障代码 就是0X200 = hfdcan1.ErrorCode 是不是外部硬件有问题,还是外部晶震有问题,USART1一直都是正常发送 我是每秒触发两次发送CAN,困惑我好多天了,大家没有遇到过QQ422866299 /* 配置FDCAN1 */ hfdcan1.Instance = FDCAN1; hfdcan1.Init.FrameFormat = FDCAN_FRAME_FD_NO_BRS; hfdcan1.Init.Mode = FDCAN_MODE_NORMAL; hfdcan1.Init.AutoRetransmission = DISABLE; hfdcan1.Init.TransmitPause = DISABLE; hfdcan1.Init.ProtocolException = ENABLE; hfdcan1.Init.NominalPrescaler = 0x0AU; hfdcan1.Init.NominalSyncJumpWidth= 0x08U; hfdcan1.Init.NominalTimeSeg1 = 0x1FU; hfdcan1.Init.NominalTimeSeg2 = 0x08U; hfdcan1.Init.DataPrescaler = 0x0AU; hfdcan1.Init.DataSyncJumpWidth = 0x04U; hfdcan1.Init.DataTimeSeg1 = 0x0FU; hfdcan1.Init.DataTimeSeg2 = 0x04U; hfdcan1.Init.MessageRAMOffset = 0x00U; hfdcan1.Init.StdFiltersNbr = 0x01U; hfdcan1.Init.ExtFiltersNbr = 0x00U; hfdcan1.Init.RxFifo0ElmtsNbr = 0x02U; hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8; hfdcan1.Init.RxFifo1ElmtsNbr = 0x00U; hfdcan1.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8; hfdcan1.Init.RxBuffersNbr = 0x00U; hfdcan1.Init.RxBufferSize = 0x00U; hfdcan1.Init.TxEventsNbr = 0x00U; hfdcan1.Init.TxBuffersNbr = 0x00U; hfdcan1.Init.TxFifoQueueElmtsNbr = 0x02U; hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION; hfdcan1.Init.TxElmtSize = FDCAN_DATA_BYTES_8; /* 配置过滤器 */ sFilterConfig1.IdType = FDCAN_EXTENDED_ID; sFilterConfig1.FilterIndex = 0x00U; sFilterConfig1.FilterType = FDCAN_FILTER_MASK; sFilterConfig1.FilterConfig = FDCAN_FILTER_TO_RXFIFO0; sFilterConfig1.FilterID1 = 0x00U; sFilterConfig1.FilterID2 = 0x00U; HAL_FDCAN_ConfigFifoWatermark(&hfdcan1, FDCAN_CFG_RX_FIFO0, 0x01U);/* 设置Rx FIFO0的wartermark为1 */ HAL_FDCAN_ActivateNotification(&hfdcan1,FDCAN_IT_RX_FIFO0_WATERMARK,0x00U); /* 开启中断*/ HAL_FDCAN_Start(&hfdcan1);/* 启动FDCAN */ /* 配置发送参数 */ TxHeader.Identifier = receiveId; TxHeader.IdType = FDCAN_EXTENDED_ID; TxHeader.TxFrameType = FDCAN_DATA_FRAME; TxHeader.DataLength = (uint32_t)((_Len & 0xFFU) << 0x10U); TxHeader.ErrorStateIndicator = FDCAN_ESI_ACTIVE; TxHeader.BitRateSwitch = FDCAN_BRS_OFF; TxHeader.FDFormat = FDCAN_FD_CAN; TxHeader.TxEventFifoControl = FDCAN_NO_TX_EVENTS; TxHeader.MessageMarker = 0x00U; if(HAL_FDCAN_AddMessageToTxFifoQ(fdcanH, &TxHeader, _DataBuf) != HAL_OK) mo = 0x01U ;else mo = 0x00U ; return mo; /* 系统时钟配置 */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; // RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.LSEState = RCC_LSE_ON; RCC_OscInitStruct.LSIState = RCC_LSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 5; RCC_OscInitStruct.PLL.PLLN = 96; RCC_OscInitStruct.PLL.PLLP = 2; RCC_OscInitStruct.PLL.PLLQ = 2; RCC_OscInitStruct.PLL.PLLR = 2; RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2; RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; RCC_OscInitStruct.PLL.PLLFRACN = 0; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } /** Initializes the CPU, AHB and APB buses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV1; RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2; RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2; RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK) { Error_Handler(); } PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC|RCC_PERIPHCLK_FDCAN; PeriphClkInitStruct.PLL2.PLL2M = 25; PeriphClkInitStruct.PLL2.PLL2N = 200; PeriphClkInitStruct.PLL2.PLL2P = 2; PeriphClkInitStruct.PLL2.PLL2Q = 2; PeriphClkInitStruct.PLL2.PLL2R = 2; PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_0; PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOMEDIUM; PeriphClkInitStruct.PLL2.PLL2FRACN = 0; PeriphClkInitStruct.FdcanClockSelection = RCC_FDCANCLKSOURCE_PLL2; PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { Error_Handler(); } __HAL_RCC_CSI_ENABLE() ; /* 使能CSI时钟 */ __HAL_RCC_SYSCFG_CLK_ENABLE() ; /* 使能SYSCFG时钟 */ HAL_EnableCompensationCell(); /* 使能IO补偿单元 */ |
问题找到了 |
STM32H750内部flash读写
智能算法芯片有推荐的吗?
STM32H743采用flash swap 进行IAP升级,reset后启动不了
STM32双核H7核间通信的方法
MCSDK6.3.1使用SIXSTEP如何才能使用电流模式呢?我在配置了电流传感器后仍然无法使用电流模式。
STM32H743IIC,HAL库驱动硬件I2C,hi2c2.state一直是busy. 为什么?
H747 DSI 模块的官方例程跑不通
关于l9663的SPI无法正常写入数值的问题
MAC回环或以太网PHY芯片回环怎么实现?
STM32745/747芯片固件升级问题