Can Bus, sending and receiving does not work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-15 12:25 PM
ghhhhhhhhhhhhk
#lmgtfy #can-bus #stm32f207 #can-prescale-and-quanta- Labels:
-
CAN
-
STM32F2 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-15 1:22 PM
When CAN doesn't work the first thing to do is check the ESR error status on both nodes (you need two, won't work for one). Are both nodes configured the same way, and is the ESR the same?
Jack Peacock- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-15 11:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-16 4:42 AM
void
system_error_handle(eError error)
{
while
(
true
);
}
when i try to get some message from converter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-16 5:13 AM
Do you have the peripheral clock enabled for CAN. Not sure what the HAL library does, but you need to make sure the CAN clock is enabled in the RCC. Registers that show zero are a common symptom of clock disabled.
Jack Peacock- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-16 5:24 AM
Yes, the CAN clock is enabled but I don't see where theSYSCFG clock is set up, nor where the CAN pins are configured as AF.
For an F405 using PD0 and PD1 on CAN1:RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_CAN1); // CAN1 rx
GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_CAN1); // CAN1 tx
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; // alternate function, CAN bus
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // push-pull driver
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; // with pull-ups
GPIO_Init(GPIOD, &GPIO_InitStructure); // enable CAN bus pins
Jack Peacock
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-16 5:46 AM
I was checked, CAN1 clock is on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-16 5:54 AM
I was change pin mode to AF, but still dont works ;/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-16 6:08 AM
hjghkgghkghk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-16 7:55 AM
May be you want to look at how other boards implement CAN, and how it's configured and working using the Standard Peripheral Library. I know I've posted a couple of F2 examples.
I'm not keen to dig through the register level configuration, or reinvent the wheel.You need CAN transceivers, and TWO devices on the bus, ideally one configured as a listener. The transceivers need enabling, if they have such a pin. The bit/baud rate is predicated on the APB bus clock, the prescaler, and the bit timing settings.Up vote any posts that you find helpful, it shows what's working..
