hoahuubui opened a new pull request, #22114:
URL: https://github.com/apache/nuttx/pull/22114
## Summary
Add CAN-FD support for the Renesas RZ/V2H (Cortex-R8, CPU0) for RZV2H-EVK
and RZV2H-RDK.
Channels 0-5 are available and each one is enabled with
`CONFIG_RZV2H_CANFDn`. The application interface is chosen at build time:
- Character device `/dev/can<n>` through the NuttX CAN upper half
(`CONFIG_CAN`), or
- SocketCAN network interface `can<n>` (`CONFIG_RZV2H_CANFD_SOCKET`,
`CONFIG_NET_CAN`).
Each channel has Kconfig options for the nominal and data bit rates, delay
compensation, RX FIFOs, TX message buffers, channel error interrupts,
interrupt-select (SEL) IRQ numbers and interrupt priority. Error reporting
and internal/external loopback modes are supported.
The series has three commits:
1. `arch/arm/rzv2h`: CAN-FD driver (`rzv2h_canfd.c/.h`), Kconfig, Make.defs,
CMake, CANFD pin definitions, the `RZV2H_GPIO_OUTPUT` helper for
transceiver standby pins, and the `R_CANFD_` prefix in `tools/nxstyle.c`.
2. `boards/arm/rzv2h`: CANFD pin and transceiver standby definitions in
`board.h`, CAN-FD registration in board bring-up, and five defconfigs per
board: `can-loopback`, `can-socketcan`, `can-dronecan`,
`can-opencyphal` and `can-slcan`.
3. `Documentation/arm/rzv2h`: documentation for the driver and both boards.
## Impact
- New feature, off by default. Nothing changes for existing RZ/V2H
configurations unless `CONFIG_RZV2H_CANFD` is enabled.
- Ten new board configurations (five per board), listed above.
- Documentation: new CAN sections for the RZ/V2H platform page and both
board pages.
## Testing
Host: Linux Ubuntu 24.04, arm-none-eabi-gcc 13.2.1
Build checks:
- `rzv2h-rdk:can-loopback`, `rzv2h-rdk:can-socketcan`,
`rzv2h-rdk:can-dronecan`,
`rzv2h-rdk:can-opencyphal` and `rzv2h-rdk:can-slcan` build with the new
driver (`rzv2h_canfd.c`) compiling without warnings.
- `rzv2h-evk:can-loopback`, `rzv2h-evk:can-socketcan`,
`rzv2h-evk:can-dronecan`,
`rzv2h-evk:can-opencyphal` and `rzv2h-evk:can-slcan` build with the new
driver (`rzv2h_canfd.c`) compiling without warnings.
- `tools/checkpatch.sh` passes on all changed files, and the pre-commit
hooks (nxstyle, cmake-format, codespell) pass.
Runtime checks on hardware (loop-back mode):
Board: RZ/V2H-RDK
`./tools/configure.sh -l rzv2h-rdk:can-loopback && make`
```
NuttShell (NSH) NuttX-13.1.1-RC0
nsh> ls /dev
/dev:
can0
console
gpio0
gpio1
gpio2
null
ttyS0
zero
nsh> can -n 20
nmsgs: 20
min ID: 1 max ID: 536870911
Bit timing:
Baud: 500000
TSEG1: 119
TSEG2: 40
SJW: 4
ID: 1 DLC: 1
ID: 1 DLC: 1
ID: 1 DLC: 1 -- OK
ID: 2 DLC: 2
ID: 2 DLC: 2
ID: 2 DLC: 2 -- OK
ID: 3 DLC: 3
ID: 3 DLC: 3
ID: 3 DLC: 3 -- OK
ID: 4 DLC: 4
ID: 4 DLC: 4
ID: 4 DLC: 4 -- OK
ID: 5 DLC: 5
ID: 5 DLC: 5
ID: 5 DLC: 5 -- OK
ID: 6 DLC: 6
ID: 6 DLC: 6
ID: 6 DLC: 6 -- OK
ID: 7 DLC: 7
ID: 7 DLC: 7
ID: 7 DLC: 7 -- OK
ID: 8 DLC: 8
ID: 8 DLC: 8
ID: 8 DLC: 8 -- OK
ID: 9 DLC: 9
ID: 9 DLC: 9
ID: 9 DLC: 9 -- OK
ID: 10 DLC: 10
ID: 10 DLC: 10
ID: 10 DLC: 10 -- OK
ID: 11 DLC: 11
ID: 11 DLC: 11
ID: 11 DLC: 11 -- OK
ID: 12 DLC: 12
ID: 12 DLC: 12
ID: 12 DLC: 12 -- OK
ID: 13 DLC: 13
ID: 13 DLC: 13
ID: 13 DLC: 13 -- OK
ID: 14 DLC: 14
ID: 14 DLC: 14
ID: 14 DLC: 14 -- OK
ID: 15 DLC: 15
ID: 15 DLC: 15
ID: 15 DLC: 15 -- OK
ID: 16 DLC: 1
ID: 16 DLC: 1
ID: 16 DLC: 1 -- OK
ID: 17 DLC: 2
ID: 17 DLC: 2
ID: 17 DLC: 2 -- OK
ID: 18 DLC: 3
ID: 18 DLC: 3
ID: 18 DLC: 3 -- OK
ID: 19 DLC: 4
ID: 19 DLC: 4
ID: 19 DLC: 4 -- OK
ID: 20 DLC: 5
ID: 20 DLC: 5
ID: 20 DLC: 5 -- OK
Terminating!
nsh>
```
Board: RZ/V2H-EVK
`./tools/configure.sh -l rzv2h-evk:can-loopback && make`
```
NuttShell (NSH) NuttX-13.1.1-RC0
nsh> ls /dev
/dev:
can0
console
gpio0
gpio1
gpio2
null
ttyS0
zero
nsh> can -n 20
nmsgs: 20
min ID: 1 max ID: 536870911
Bit timing:
Baud: 500000
TSEG1: 119
TSEG2: 40
SJW: 4
ID: 1 DLC: 1
ID: 1 DLC: 1
ID: 1 DLC: 1 -- OK
ID: 2 DLC: 2
ID: 2 DLC: 2
ID: 2 DLC: 2 -- OK
ID: 3 DLC: 3
ID: 3 DLC: 3
ID: 3 DLC: 3 -- OK
ID: 4 DLC: 4
ID: 4 DLC: 4
ID: 4 DLC: 4 -- OK
ID: 5 DLC: 5
ID: 5 DLC: 5
ID: 5 DLC: 5 -- OK
ID: 6 DLC: 6
ID: 6 DLC: 6
ID: 6 DLC: 6 -- OK
ID: 7 DLC: 7
ID: 7 DLC: 7
ID: 7 DLC: 7 -- OK
ID: 8 DLC: 8
ID: 8 DLC: 8
ID: 8 DLC: 8 -- OK
ID: 9 DLC: 9
ID: 9 DLC: 9
ID: 9 DLC: 9 -- OK
ID: 10 DLC: 10
ID: 10 DLC: 10
ID: 10 DLC: 10 -- OK
ID: 11 DLC: 11
ID: 11 DLC: 11
ID: 11 DLC: 11 -- OK
ID: 12 DLC: 12
ID: 12 DLC: 12
ID: 12 DLC: 12 -- OK
ID: 13 DLC: 13
ID: 13 DLC: 13
ID: 13 DLC: 13 -- OK
ID: 14 DLC: 14
ID: 14 DLC: 14
ID: 14 DLC: 14 -- OK
ID: 15 DLC: 15
ID: 15 DLC: 15
ID: 15 DLC: 15 -- OK
ID: 16 DLC: 1
ID: 16 DLC: 1
ID: 16 DLC: 1 -- OK
ID: 17 DLC: 2
ID: 17 DLC: 2
ID: 17 DLC: 2 -- OK
ID: 18 DLC: 3
ID: 18 DLC: 3
ID: 18 DLC: 3 -- OK
ID: 19 DLC: 4
ID: 19 DLC: 4
ID: 19 DLC: 4 -- OK
ID: 20 DLC: 5
ID: 20 DLC: 5
ID: 20 DLC: 5 -- OK
Terminating!
nsh>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]