We found out today that the G120 module is not able to support a CAN bus speed from 1000Kb with the current firmware. I also noticed that this speed is (no longer) listed in the documentation.
@ GHI, can you confirm you dropped (or never supported) the 1000Kb CAN speed on the G120?
It’s not possible to set a presale value to 2.5, so we changed the APB clock divider and tested this again with a presale value 5 for 1Mb (PCLKDIV = 1 instead 2 => APB clock 120Mhz instead of 60Mhz) and all test are ok.
But off course then the other devices on the APB clock are failing…
So for me with the knowledge I have at this moment, it is not possible to get a correct CAN bit timing for 1Mb on the G120 (with the current firmware)
Please correct me if I’m wrong, I will happy to admit I’m wrong if you can show me how to get this working I even send you some beers
We also added the Synchronization Jump Width as a aparameter in the CAN init, using values 1,2 and 3 but the difference is to big. With a BRP 2 you get a speed off 1250 Kb and BRP 1 gives 833 Kb. (using 60Mhz as APB Clock)
@ Gus - Is it possible to give me a simple yes/no answer pretty please so I know what my options are?
I’m facing a deadline here on a commercial application in 7 day’s.
If it’s a no then I have 2 options:
switch back to EMX (this works) but then I have to make the electronic engineers work the night shift and order new PCB’s on next day delivery… It’s possible with Euro circuits but the overhead cost is significant. ( i already had to order my V1 board this way)
Make all other devices we absolutely need work on the 120Mhz APB clock by register poking… could work but no way to tell until it’s actual is working…
If it’s a yes, then I can focus on testing and wait for your answer or work around.
A clear answer is much appreciated.
You can also just email me at dv at emrol dot com if we need to discuss this off the forum.
I’d give GHI a direct call on this one to make sure you get an answer in a timeframe that doesn’t require someone to read a post on the forum… Edit: then Gus reads the forum
Between 2 G120 modules this “could” work because both would ha a “wrong” speed…
But then again, no this is not working , we put both CAN1 and CAN2 on the same bus with the correct messages and filters and all we get is buss off errors when we add a 3e CAN unit (analyzer or EMX module)
CAN1 sending to CAN2 and vica versa is not working.
After we have been looking a bit “deeper” in to this issue it seems there is no real “rocket since” involved. It’s just a mathematic issue.
If on a clock = 60Mhz for the APB devices CAN is working fine (tested an calculated) with a BRP 5 for 500kb, 10 for 250kb and 20 for 125Kb it is absolutely logical to get BRP 2.5 for 1000Kb. but putting 2.5 in 10 bit is just not possible. So we started to read out the APB divider (default on 4 but set on 2 by the GHI firm ware) and got the idea to change this to 1, so we could use 5-10-20-40 as BRP and this worked like a train in all test!
Register PClockDivider = new Register(0x400FC1A8);
PClockDivider.Write(1);
And this only worked when we use USB debugging because UART is on the same clock.
(we use COM debugging because USB client and host are used in this project)
Except for the timing differences, are there known stability issues with the firmware running the APB clock on 120Mhz? We noticed a great speed improvement on SD access and mounting SD or USB host memory against the USB client interface… Not sure why because the USB clock is a separate one…But in general I think we won about 3 seconds in the boot / initialize faze by changing the clock speed.