Closed zalexzperez closed 4 months ago
Well, I figured it out. It was unexpectedly easier.
Simply edit esp32_can_builtin_local.cpp line 20 where twai_speed_cfg is.
So, for 95kbps, we should have:
twai_timing_config_t twai_speed_cfg = {.brp = 42, .tseg_1 = 15, .tseg_2 = 4, .sjw = 3, .triple_sampling = false};
Current baud rate is set to 500kbps apparently using the next line
settings.canSettings[0].nomSpeed = 500000
What if I need a custom baudrate like 95kbps or 33.3kbps?I already have the bit timing macro initializers from another project using TWAI:
#define TWAI_TIMING_CONFIG_95KBITS() {.brp = 42, .tseg_1 = 15, .tseg_2 = 4, .sjw = 3, .triple_sampling = false}
#define TWAI_TIMING_CONFIG_33k3KBITS() {.brp = 120, .tseg_1 = 15, .tseg_2 = 4, .sjw = 3, .triple_sampling = false}