Jan Sommer created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5219
## Summary Backport of https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5166. We have a GR712RC and use the _occan_ lib for the operation of the CAN core, but had weird results regarding the measured baud rate when calling `occanlib_set_speed`. We used the current RCC from Gaisler and the `rtems-occan` example for testing. There are 2 errors in the code: ### BRP not correctly calculated In the data sheet of the GR712RC it states:  ```c /* calculate scaler */ tmp = ((br->divfactor + tseg) * baud); sc = (core_hz * 2)/ tmp - core_hz / tmp; ``` Which is the same as `sc = core_hz/ tmp`, so the division by 2 of the core is not correctly calculated. ### BTR1 register values not correct >From the GR712RC manual the following formulas are given for the TSEG values >of the BTR1 register:  However, `occanlib_set_speed` eventually calls `grlib_canbtrs_calc_timing` which returns the full TSEG values (including the +1). The subsequent call to `convert_timing_to_btrs` writes these values to the registers without subtracting the +1, resulting in two time segments to many. ## Steps to reproduce * Call `occanlib_set_speed` (for example use rtems-occan of the RCC as a base). * Observe the written register values in GRMON * Measure baud rate on oscilloscope and compare with desired value ## Expected behaviour Correct baud rate measured. ### Pre-set options -- View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5219 You're receiving this email because of your account on gitlab.rtems.org.
_______________________________________________ bugs mailing list bugs@rtems.org http://lists.rtems.org/mailman/listinfo/bugs