Closed munzili closed 1 year ago
Baudrates calculation was done with: https://www.kvaser.com/support/calculators/bit-timing-calculator/
Hi @munzili :coffee: :wave:
Thank you for your PR. However, I'm not entirely happy with it, i.e. You've computed different values for baud-rates that are already known to be working, i.e.
Before:
static CanBitRateConfig constexpr BitRate_250kBPS_16MHz = {0x41, 0xF1, 0x85};
After:
static CanBitRateConfig constexpr BitRate_250kBPS_16MHz = {0x01, 0xb5, 0x01};
That gives me little confidence in all the other values. Also I frankly don't have the time to manually check all the baud rates. I'm open to accept part of your changes but I'm not going to throw away baud-rates that I happen to know work - unless you take on the work of verifying all those baud rates on real hardware.
Since 12 MHz are new and you seem to want that, why not focus on that first?
Well, actually i need 12mhz support AND different baudrates.
if you wish, i change the PR to only support the new baudrates and the 12mhz chip and leave the old values. I tested 12mhz with 20kbps.
The new values should be conform with the CANopen standard based on this document https://www.can-cia.org/fileadmin/resources/documents/proceedings/2003_koppe.pdf by setting the baudrates and the sample point to the values defined in the document
if you wish, i change the PR to only support the new baudrates and the 12mhz chip and leave the old values. I tested 12mhz with 20kbps.
That would be an acceptable proposition.
Btw. controller type in your online calculator seems to only support MCP2510. Not sure on the difference though. Here seems to be another tool: https://intrepidcs.com/products/free-tools/mb-time-calculator/ . Anything you can do to increase my confidence in this change would be appreciated.
https://ww1.microchip.com/downloads/en/Appnotes/00872a.pdf
the MCP2515 is based on MCP2510 but CNF flags are equal except CNF3 7bit but this bit was not setted before too
The MCP2515 is based on MCP2510 but CNF flags are equal except CNF3 7bit but this bit was not setted before too
Works for me :+1: . Only the changes for 12 MHz then plus your missing baud rates.
Hi. setting the sample point is a nice issue.
I think with the previous settings we have a sample point of 0.75. In some settings a different sample point might be useful. So I highly support this topic. But maybe we find a different approach to set the sample point. Unfortunately I havent seen any arduino can driver which supports this issue in a nice way.
So you'd offer to do some testing with these value @generationmake ?
Relevant for our applications are 250k/500k/1MBit/s at 16 MHz.
Memory usage change @ 5c0f1161dc8c97c1660ed4369dc8c11778a87045
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
arduino:mbed_edge:edge_control | :small_red_triangle: +64 - +64 | +0.01 - +0.01 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_nano:nano33ble | :small_red_triangle: +64 - +64 | +0.01 - +0.01 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_nano:nanorp2040connect | :small_red_triangle: +66 - +66 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkr1000 | :small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrfox1200 | :small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrgsm1400 | :small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrnb1500 | :small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrvidor4000 | :small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwan1300 | :small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwan1310 | :small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwifi1010 | :small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrzero | :small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
esp32:esp32:esp32 | :small_red_triangle: +64 - +64 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
rp2040:rp2040:rpipico | :small_red_triangle: +64 - +72 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
I have restored the original flag definitions
Memory usage change @ e05959771e922262279e6d4fd58d9a7f174990ad
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
arduino:mbed_edge:edge_control |
:small_red_triangle: +64 - +64 | +0.01 - +0.01 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_nano:nano33ble |
:small_red_triangle: +64 - +64 | +0.01 - +0.01 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_nano:nanorp2040connect |
:small_red_triangle: +66 - +66 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_portenta:envie_m7:target_core=cm4 |
N/A | N/A | N/A | N/A |
arduino:mbed_portenta:envie_m7 |
N/A | N/A | N/A | N/A |
arduino:samd:mkr1000 |
:small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrfox1200 |
:small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrgsm1400 |
:small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrnb1500 |
:small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrvidor4000 |
:small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwan1300 |
:small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwan1310 |
:small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwifi1010 |
:small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrzero |
:small_red_triangle: +64 - +68 | +0.02 - +0.03 | 0 - 0 | 0.0 - 0.0 |
esp32:esp32:esp32 |
:small_red_triangle: +64 - +64 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
rp2040:rp2040:rpipico |
:small_red_triangle: +64 - +72 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
This pull requests adds