AuroraRAS opened a new pull request, #18473:
URL: https://github.com/apache/nuttx/pull/18473
## Summary
This Pull Request addresses missing functionality and incomplete
implementations within the `nrf24l01_ioctl` function of the nRF24L01 wireless
character driver. Previously, the driver lacked support for several common RF
IOCTLs defined in `nuttx/wireless/ioctl.h` and returned `-ENOSYS` for specific
device configurations.
Key changes include:
* Implemented `WLIOC_SETRADIOFREQ` and `WLIOC_GETRADIOFREQ` with
quantitative unit conversions (Hz for the API, MHz for the hardware).
* Added support for `WLIOC_SETTXPOWER`, `WLIOC_GETTXPOWER`,
`WLIOC_SETFINEPOWER`, and `WLIOC_GETFINEPOWER`.
* Added `WLIOC_SETMODU` and `WLIOC_GETMODU`, strictly enforcing `WLIOC_GFSK`
modulation as mandated by the nRF24L01 hardware specifications.
* Mapped `WLIOC_SETADDR` and `WLIOC_GETADDR` to the existing TX address
routines, maintaining 100% backward compatibility via `nrf24l01.h` macro
aliases.
* Resolved `-ENOSYS` in `NRF24L01IOC_GETRETRCFG` by implementing direct
reads of the `NRF24L01_SETUP_RETR` register and decoding the ARD/ARC shift bits.
* Resolved `-ENOSYS` in `NRF24L01IOC_GETDATARATE` by parsing the `RF_DR_LOW`
and `RF_DR_HIGH` bits from the `NRF24L01_RF_SETUP` register.
## Impact
* **Users**: Can now utilize standard `wlioc` structures and common wireless
IOCTLs to configure the nRF24L01, allowing for better interoperability with
unified wireless application layers.
* **Compatibility**: 100% backward compatible. Legacy applications using
`NRF24L01IOC_SETTXADDR` will continue to function seamlessly due to macro
expansion.
* **Hardware**: Prevents hardware misconfiguration by explicitly rejecting
non-GFSK modulation requests with `-EINVAL`.
## Testing
Hardware validation was performed on an ESP32 board running NuttX, patterned
after the EvilCrowRF-V2 project.
**Methodology:**
A dedicated test application (`ecrf_test`) was executed to perform
closed-loop Write-Read-Verify operations on the character device
(`/dev/nrf24l01`). The test ensures quantitative accuracy by writing values,
reading them back from the hardware registers, and comparing them against
expected outcomes, including edge-case hardware rejection (e.g., verifying that
passing `WLIOC_LORA` to modulation settings returns a failure).
**Runtime Logs:**
```text
nsh> ecrf_test
--- EvilCrowRF-V2 Hardware Validation ---
Testing device: /dev/radio0
[PASS] FD: 3
Starting CC1101 IOCTL hardware test on /dev/radio0...
[PASS] Frequency: Target 433000000 Hz, Actual 432999816 Hz
[PASS] Address: Target 0x5A, Actual 0x5A
[PASS] TX Power Index: Target 2, Actual 2
[PASS] Modulation: Target 2, Actual 2
[PASS] Bitrate: Target 250000 bps, Actual 249938 bps
[PASS] FSK Deviation: Target 47000 Hz, Actual 44433 Hz
CC1101 IOCTL hardware test completed successfully.
Testing device: /dev/radio1
[PASS] FD: 3
Starting CC1101 IOCTL hardware test on /dev/radio1...
[PASS] Frequency: Target 433000000 Hz, Actual 432999816 Hz
[PASS] Address: Target 0x5A, Actual 0x5A
[PASS] TX Power Index: Target 2, Actual 2
[PASS] Modulation: Target 2, Actual 2
[PASS] Bitrate: Target 250000 bps, Actual 249938 bps
[PASS] FSK Deviation: Target 47000 Hz, Actual 44433 Hz
CC1101 IOCTL hardware test completed successfully.
Testing device: /dev/nrf24l01
[PASS] FD: 3
Starting nRF24L01 IOCTL tests...
[PASS] Freq: 2450000000 Hz
[PASS] TX Power: -6 dBm
[PASS] Fine TX Power: 0 (0.01 dBm)
[PASS] Modulation correctly rejected non-GFSK.
[PASS] Address: AA:BB:CC:DD:EE
[PASS] Retransmit Config (Delay: 5, Count: 10)
[PASS] Data Rate: 2Mbps
[PASS] State Transition to STANDBY
[PASS] TX Payload NoACK: Enabled
Testing completed. Failures: 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]