tmedicci opened a new pull request, #17067:
URL: https://github.com/apache/nuttx/pull/17067
## Summary
* risc-v/espressif/twai: Update common source code functions
Updates the common source code for the twai peripheral used by Espressif's
RISC-Vs SoCs. This enables newer SoCs to be supported in the future while
maintaining backwards compatibility.
## Impact
Impact on user: No.
Impact on build: No.
Impact on hardware: Not yet: newer Espressif SoCs can be supported on NuttX
following this change.
Impact on documentation: No.
Impact on security: No.
Impact on compatibility: No. It's totally backwards compatible.
## Testing
Testing can be performed using any of the `twai` defconfig available for any
of Espressif's RISC-V-based devices (ESP32-C3, ESP32-C6, or ESP32-H2). The
behavior of the twai didn't change, and this PR's results are the same of the
results before it. This can be verified:
### Building
#### ESP32-C3
```
make -j distclean && ./tools/configure.sh esp32c3-generic:twai &&
kconfig-tweak -e DEBUG_ASSERTIONS && kconfig-tweak -e DEBUG_FEATURES &&
kconfig-tweak -e CAN_LOOPBACK && kconfig-tweak -e ESPRESSIF_TWAI_TEST_MODE &&
kconfig-tweak --set-val ESPRESSIF_TWAI0_TXPIN 8 && kconfig-tweak --set-val
ESPRESSIF_TWAI0_RXPIN 8 && make olddefconfig && make flash
ESPTOOL_PORT=/dev/ttyUSB0 && picocom -b 115200 /dev/ttyUSB0
```
#### ESP32-C6
##### TWAI0
```
make -j distclean && ./tools/configure.sh esp32c6-devkitc:twai &&
kconfig-tweak -e DEBUG_ASSERTIONS && kconfig-tweak -e DEBUG_FEATURES &&
kconfig-tweak -e CAN_LOOPBACK && kconfig-tweak -e ESPRESSIF_TWAI_TEST_MODE &&
kconfig-tweak --set-val ESPRESSIF_TWAI0_TXPIN 8 && kconfig-tweak --set-val
ESPRESSIF_TWAI0_RXPIN 8 && make olddefconfig && make flash
ESPTOOL_PORT=/dev/ttyUSB0 && picocom -b 115200 /dev/ttyUSB0
```
##### TWAI1
```
make -j distclean && ./tools/configure.sh esp32c6-devkitc:twai &&
kconfig-tweak -e DEBUG_ASSERTIONS && kconfig-tweak -e DEBUG_FEATURES &&
kconfig-tweak -e CAN_LOOPBACK && kconfig-tweak -e ESPRESSIF_TWAI_TEST_MODE &&
kconfig-tweak -d ESPRESSIF_TWAI0 && kconfig-tweak -e ESPRESSIF_TWAI1 &&
kconfig-tweak --set-val ESPRESSIF_TWAI1_TXPIN 8 && kconfig-tweak --set-val
ESPRESSIF_TWAI1_RXPIN 8 && kconfig-tweak --set-str EXAMPLES_CAN_DEVPATH
"/dev/can1" && make olddefconfig && make flash ESPTOOL_PORT=/dev/ttyUSB0 &&
picocom -b 115200 /dev/ttyUSB0
```
#### ESP32-H2
```
make -j distclean && ./tools/configure.sh esp32h2-devkit:twai &&
kconfig-tweak -e DEBUG_ASSERTIONS && kconfig-tweak -e DEBUG_FEATURES &&
kconfig-tweak -e CAN_LOOPBACK && kconfig-tweak -e ESPRESSIF_TWAI_TEST_MODE &&
kconfig-tweak --set-val ESPRESSIF_TWAI0_TXPIN 8 && kconfig-tweak --set-val
ESPRESSIF_TWAI0_RXPIN 8 && make olddefconfig && make flash
ESPTOOL_PORT=/dev/ttyUSB0 && picocom -b 115200 /dev/ttyUSB0
```
### Running
Run the `can` application and expect it to exit with success code:
```
nsh> can -n 5 -b 5
```
### Results
```
nsh> can -n 5 -b 5
nmsgs: 5
min ID: 1 max ID: 5
Bit timing:
Baud: 727272
TSEG1: 16
TSEG2: 5
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
Terminating!
nsh> echo $?
0
```
--
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]