lpc 11c24 CAN baudrate limited to 125kBit/s

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

lpc 11c24 CAN baudrate limited to 125kBit/s

跳至解决方案
1,440 次查看
Psy_coder
Contributor II

The mcu is LPC11c24

I am connected on PCAN view

The library is lpcopen_v2_00a_lpcxpresso_nxp_lpcxpresso_11c24.zip

I'm running the example: nxp_lpcxpresso_11c24_periph_ccan_rom

It's running very well with the baudrates: 125kBit/s and lower. but as soon as I get to 250kBit/s and higher I get BUSHEAVY on PCAN View

I tried with the function baudrateCalculate() and filling the array CanApiClkInitTable[0] = 0;  CanApiClkInitTable[1] = 0x000076CB; (for 250kBit/s)

Both methods behave the same way, ie they only work when the baudrate is less than 125kBits/s

The datasheet says " If C_CAN baudrates above 100 kbit/s are required, the system oscillator must
be selected as the clock source for the system clock "

I have my SYSPLLCLKSEL as 0x00000001; to select System oscillator

I have my MAINCLKSEL as 0x00000003; to select System PLL clock out

from XTALIN of 12MHz the clock at AHB is 48MHz

After getting the BUSHEAVY problem I realised both the IRC_PD and SYSOSC_PD in the PDRUNCFG register are powered, so I thought maybe I should power down the IRC_PD so I added this line LPC_SYSTCTL->PDRUNCFG |= 1 << 1;

With still no success, I cut my can-bus wires from about 15 cm and I reduced them to about 8 cm but still no luck

Has anyone ever ran the example I mentioned and seen it working with 250kbits/s baudrate without modifications?

Is there a fine print that I'm missing?

 

标签 (1)
0 项奖励
1 解答
1,417 次查看
frank_m
Senior Contributor III

>... but as soon as I get to 250kBit/s and higher I get BUSHEAVY on PCAN View

Have you checked the bus with a scope in this case ?

The PCAN error message "bus heavy" is a very broad description. If I remember correctly, I get the same  message on certain busses without a proper terminator resistance.

在原帖中查看解决方案

0 项奖励
5 回复数
1,418 次查看
frank_m
Senior Contributor III

>... but as soon as I get to 250kBit/s and higher I get BUSHEAVY on PCAN View

Have you checked the bus with a scope in this case ?

The PCAN error message "bus heavy" is a very broad description. If I remember correctly, I get the same  message on certain busses without a proper terminator resistance.

0 项奖励
1,401 次查看
Psy_coder
Contributor II

Thanks @frank_m apparently my problem was termination resistors. I had them on my bus already but it looks like they were too far from my can-usb dongle. I moved them closer and I can now run successfully on 250k

0 项奖励
1,396 次查看
frank_m
Senior Contributor III

That sounds like your cabling is not quite the best, impedance-wise.

The cable must have bandwidth of at least 10 times the baudrate, or else the hardware will not recognize the distorted signals.

I use either shielded cable, or twist them manually to achieve a consistent impedance.

1,422 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As the UM10398.pdf says that you have to use the system oscillator when the CAN bus baud-rate is greater than 100K, because the external crystal or clock source is of more accurate clock frequency.

Regarding your configuration that the CanApiClkInitTable[1] = 0x000076CB, with 48MHz system clock, I have computed, the C_CAN baudrate is 250K.

Could you output the system clock to CLKOUT pin so that you can connect a scope and make sure the system clock is 48mhz.

I have checked the original source of CAN, it appears that the baud rate is 500K, because it is defined

#define TEST_CCAN_BAUD_RATE 500000

This is the LPCOpen link:

https://www.nxp.com/design/microcontrollers-developer-resources/lpcopen-libraries-and-examples/lpcop...

Have you tried to use 500K baud rate?

BR

XiangJun Rong

1,398 次查看
Psy_coder
Contributor II

I did output my CLKOUT pin to the oscilloscope and it was giving me 48MHz frequency. The only thing that was weird is the signal was somewhere between sine wave and triangular wave, but I think that's because my oscilloscope bandwidth is only 100MS/s. My problem was termination resistor because after moving it along the bus closer to the can-usb dongle allowed me to run at 250k. I still can't run at 500k yet but now atleast I know I have hardware not software issue, so I can focus on the hardware side and stop going over and over the data sheet thinking there is something I am missing.

0 项奖励