|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
CAN (Controller Area Network) bit timing: the segment counts for a bit rate, and the limits of each controller. See can_timing.h. More...
Functions | |
| void | can_timing_limits_mcp2515 (can_timing_limits_t *out, uint32_t crystal_hz) |
| void | can_timing_limits_twai (can_timing_limits_t *out) |
| The panel's TWAI on the ESP32-P4, off the 40MHz crystal: even prescalers from 2 to 32768. | |
| static uint32_t | sp_error (uint8_t tseg1, uint8_t tq, uint16_t target) |
| bool | can_timing_solve (const can_timing_limits_t *lim, uint32_t bitrate, uint16_t target_permille, can_timing_t *out) |
| uint32_t | can_timing_max_bitrate (const can_timing_limits_t *lim) |
| bool | mcp2515_encode_timing (const can_timing_t *t, uint8_t cnf[3]) |
CAN (Controller Area Network) bit timing: the segment counts for a bit rate, and the limits of each controller. See can_timing.h.
SPDX-License-Identifier: MIT
| void can_timing_limits_mcp2515 | ( | can_timing_limits_t * | out, |
| uint32_t | crystal_hz ) |
The IOmcu's XL2515 (MCP2515-compatible), given its crystal.
| void can_timing_limits_twai | ( | can_timing_limits_t * | out | ) |
The panel's TWAI on the ESP32-P4, off the 40MHz crystal: even prescalers from 2 to 32768.
| out | Filled with the limits; NULL is ignored. |
| uint32_t can_timing_max_bitrate | ( | const can_timing_limits_t * | lim | ) |
The highest rate this controller can reach exactly, or 0 if none.
| bool can_timing_solve | ( | const can_timing_limits_t * | lim, |
| uint32_t | bitrate, | ||
| uint16_t | target_permille, | ||
| can_timing_t * | out ) |
Solve for the segmentation closest to target_permille that hits bitrate exactly.
False when no combination does, which means the source clock cannot make the rate.
| bool mcp2515_encode_timing | ( | const can_timing_t * | t, |
| uint8_t | cnf[3] ) |
Encode a solution into CNF1..CNF3.
cnf receives three bytes in register order CNF1, CNF2, CNF3.
tseg1 is split into propagation and phase-1 segments here, because that split is the MCP2515's business: both are 1..8 quanta, and the bus does not care where the boundary falls. Returns false if the solution cannot be expressed; a tseg1 of 17 or more has no legal split.