STM32F4xx CAN2 problem
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-07-04 6:18 AM
Posted on July 04, 2013 at 15:18
Hi,
I work with an STM32F405 and i cannot use the CAN2. Now, I do some tests on the discovery board on an STM32F407. And with the same code developed for CAN2 used with CAN1 all seems good. I think, that I have forgotten something, but what?This is my can configuration :static void CAN_Configuration( void ){ RCC_APB1PeriphClockCmd( RCC_APB1Periph_CAN2, ENABLE ); CAN_InitTypeDef CAN_InitStructure; CAN_FilterInitTypeDef CAN_FilterInitStructure; // CAN register init CAN_DeInit( CAN2 ); CAN_StructInit( &CAN_InitStructure ); // CAN cell init CAN_InitStructure.CAN_TTCM = DISABLE; CAN_InitStructure.CAN_ABOM = ENABLE; CAN_InitStructure.CAN_AWUM = ENABLE; CAN_InitStructure.CAN_NART = DISABLE; CAN_InitStructure.CAN_RFLM = DISABLE; CAN_InitStructure.CAN_TXFP = DISABLE; CAN_InitStructure.CAN_Mode = CAN_Mode_LoopBack; /* todo CAN_Mode_Normal */ // CAN Baudrate = 175kbps (CAN clocked at 42 MHz) CAN_InitStructure.CAN_SJW = CAN_SJW_1tq; CAN_InitStructure.CAN_BS1 = CAN_BS1_6tq; CAN_InitStructure.CAN_BS2 = CAN_BS2_8tq; CAN_InitStructure.CAN_Prescaler = 16u; CAN_Init( CAN2, &CAN_InitStructure ); // Activate CAN in debug mode CAN_DBGFreeze( CAN2, DISABLE ); // CAN filter init CAN_FilterInitStructure.CAN_FilterNumber = 0u; CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask; CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit; CAN_FilterInitStructure.CAN_FilterIdHigh = 0x0000u; CAN_FilterInitStructure.CAN_FilterIdLow = 0x0000u; CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0x0000u; CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0x0000u; CAN_FilterInitStructure.CAN_FilterFIFOAssignment = 0u; CAN_FilterInitStructure.CAN_FilterActivation = ENABLE; CAN_FilterInit( &CAN_FilterInitStructure );} #can #problem #stm32f4
Labels:
- Labels:
-
CAN
-
STM32F4 Series
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-07-04 6:41 AM
Posted on July 04, 2013 at 15:41
Problem solved :
RCC_APB1PeriphClockCmd( RCC_APB1Periph_CAN2, ENABLE ); --> RCC_APB1PeriphClockCmd(( RCC_APB1Periph_CAN1 | RCC_APB1Periph_CAN2 ), ENABLE ); CAN_FilterInitStructure.CAN_FilterNumber = 0u; --> CAN_FilterInitStructure.CAN_FilterNumber = 14u;Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-07-04 7:12 AM
Posted on July 04, 2013 at 16:12
The filter are certainly one of the issues, though I seem to recall you can change the split between the controllers.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
