2015-04-09 10:43 AM
2015-04-09 11:51 AM
CAN_InitStructure.CAN_Prescaler = 299; //This is BRP reg - can be between 1 and 1024...BRP = what is in reg + 1 (1 starts at 0)
This isn't the BRP register, the SPL subtracts ONE, you don't do it here. If you're dividing the APB clock by 300, use 3002015-04-10 04:58 AM
Do you have two CAN nodes? Loopback will work with one node but otherwise you need two in order for transmit to work properly. A single node will see transmit errors and stop. Look at your transmit error count.
Jack Peacock2015-04-10 05:49 AM
Are you using a STM32F042Fx or STM32F042Gx device? If so you need to remap PA11/12 instead of pin pair PA9/10 using the SYSCFG_CFGR1 register. Page 174 of the reference manual (RM0091).
Do you have terminators on the bus?I have some code that has the CAN module correctly working at 125Kbit/s on a STM32F042K device, but it's all in assembler.2015-04-11 08:23 AM