2015-06-15 12:25 PM
ghhhhhhhhhhhhk
#lmgtfy #can-bus #stm32f207 #can-prescale-and-quanta2015-06-15 01: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 Peacock2015-06-15 11:33 PM
2015-06-16 04:42 AM
void
system_error_handle(eError error)
{
while
(
true
);
}
when i try to get some message from converter
2015-06-16 05: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 Peacock2015-06-16 05: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
2015-06-16 05:46 AM
I was checked, CAN1 clock is on
2015-06-16 05:54 AM
I was change pin mode to AF, but still dont works ;/
2015-06-16 06:08 AM
hjghkgghkghk
2015-06-16 07: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.