Can fails to initialize on STM32F0RB Nucleo board
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-05-12 12:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-05-12 12:44 AM
Pasting in stock library code provides no insight into how you initialize the pins, clocks, etc from your own code, or call this or other library functions.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-05-12 1:07 PM
Yeah you are right!
The issue I see after debugging is that bit 0 of MSR register does not get reset by the hardware after software reset of bit 0 of the MCR register ( exiting initialization state). Any clue as to why the hardware does not reset INK ( bit 0 ) of the MSR?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-05-12 1:36 PM
This is how I configured my CAN hardware:
void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan) { GPIO_InitTypeDef GPIO_InitStruct; /*##-1- Enable peripherals and GPIO Clocks #################################*/ /* CAN1 Periph clock enable */ CAN_CLK_ENABLE(); /* Enable GPIO clock ****************************************/ CAN_GPIO_CLK_ENABLE(); /*##-2- Configure peripheral GPIO ##########################################*/ /* CAN1 TX GPIO pin configuration */ GPIO_InitStruct.Pin = GPIO_Pin_CAN_RX; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Alternate = GPIO_AF0_CAN; HAL_GPIO_Init(CAN_TX_GPIO_PORT, &GPIO_InitStruct); /* CAN1 RX GPIO pin configuration */ GPIO_InitStruct.Pin = GPIO_Pin_CAN_RX; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Alternate = GPIO_AF0_CAN; HAL_GPIO_Init(CAN_RX_GPIO_PORT, &GPIO_InitStruct); /*##-3- Configure the NVIC #################################################*/ /* NVIC configuration for CAN1 Reception complete interrupt */ HAL_NVIC_SetPriority(CAN_RX_IRQn, 1, 0); HAL_NVIC_EnableIRQ(CAN_RX_IRQn); }- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-05-12 1:48 PM
Are you mixing SPL and HAL code?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-05-12 2:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-05-12 3:03 PM
Standard Peripheral Library
STM32F072B-Discovery_FW_V1.0.1\Libraries\STM32F0xx_StdPeriph_Driver\src\stm32f0xx_can.cUp vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-05-12 9:37 PM
I am just using the SPL, exactly from the link you stated below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-05-13 7:08 AM
Ok, but you've presented HAL code being used for initialization.
I would be concerned about mixing the include files from one to the other, as the library code often uses internal bit flags, and shift settings, and not explicitly the bits used is the registers.Present complete/concise worked examples of code if you expect others to review/replicate testsUp vote any posts that you find helpful, it shows what's working..
