Commit Graph

821 Commits

Author SHA1 Message Date
Arjav Patel
70d918324b wireless/lpwan/sx127x: Update default TX power and enable CRC
Increase default TX power from 14 to 17 dBm and enable CRC
by default to improve link reliability and data integrity.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
2026-03-08 16:08:39 -03:00
Chip L.
440ad137b8 wireless/cc1101: Add standard RF IOCTL support.
Implement `cc1101_file_ioctl` to map common NuttX wireless IOCTL commands
to CC1101 hardware registers. This allows dynamic configuration of radio
parameters from user-space applications.

* Map `WLIOC_SETRADIOFREQ` and `GETRADIOFREQ` to `FREQ[2:0]`.
* Map `WLIOC_SETADDR` and `GETADDR` to `ADDR`.
* Map `WLIOC_SETTXPOWER` and `GETTXPOWER` to internal PATABLE indexing.
* Map `WLIOC_SETMODU` and `GETMODU` to `MDMCFG2`.
* Map `WLIOC_FSK_SETBITRATE` and `GETBITRATE` to `MDMCFG4` and `MDMCFG3`.
* Map `WLIOC_FSK_SETFDEV` and `GETFDEV` to `DEVIATN`.
* Normalize positive SPI status byte returns from `cc1101_access` to `OK` (0)
  to ensure POSIX compliance and prevent silently skipped register writes.

Signed-off-by: Chip L. <chplee@gmail.com>
2026-03-04 10:51:16 -03:00
Chip L.
47c7169825 wireless/nrf24l01: Implement common RF IOCTLs and fix missing register reads.
Update the nrf24l01_ioctl function to fully comply with the common wireless
character driver interface defined in nuttx/wireless/ioctl.h, and complete
previously unimplemented device-specific commands.

* Add support for WLIOC_SETRADIOFREQ and WLIOC_GETRADIOFREQ with
  quantitative conversion between Hz (API) and MHz (Hardware).
* Add support for WLIOC_SETTXPOWER, WLIOC_GETTXPOWER, WLIOC_SETFINEPOWER,
  and WLIOC_GETFINEPOWER.
* Add WLIOC_SETMODU and WLIOC_GETMODU, strictly enforcing WLIOC_GFSK
  modulation as required by the nRF24L01 physical layer.
* Map WLIOC_SETADDR and WLIOC_GETADDR to the existing TX address routines.
* Resolve -ENOSYS in NRF24L01IOC_GETRETRCFG by reading the
  NRF24L01_SETUP_RETR register and decoding ARD/ARC shift bits.
* Resolve -ENOSYS in NRF24L01IOC_GETDATARATE by parsing RF_DR_LOW and
  RF_DR_HIGH bits from the NRF24L01_RF_SETUP register.

Signed-off-by: Chip L. <chplee@gmail.com>
2026-03-02 08:07:39 -03:00
Chip L.
3582497909 wireless/cc1101: Add Kconfig option to bypass strict version check
Many third-party CC1101 modules (such as those populated on the Evil Crow
RF V2) feature clone silicon that hardcodes the VERSION register to 0x00
instead of the official 0x14.

Previously, the cc1101_checkpart() function strictly enforced
VERSION == 0x14, which caused cc1101_register() to return -ENODEV (-19)
and abort initialization on these compatible modules.

This commit introduces the CONFIG_WL_CC1101_IGNORE_VERSION Kconfig option.
- When disabled (default), the driver maintains strict official silicon
  validation. This preserves the diagnostic ability to catch hardware
  faults, such as a MISO line shorted to GND (which also reads as 0x00).
- When enabled, the driver explicitly permits VERSION == 0x00, allowing
  successful initialization and interoperability with clone chips while
  printing a warning to the syslog.

Signed-off-by: Chip L. <chplee@gmail.com>
2026-02-27 08:10:04 -03:00
wangchengdong
1608223eb3 drivers/xbee: remove nxsig_notification when signal support is disabled
When all signals are disabled, nxsig_notification is not available and
should not be invoked. Remove the call to avoid build and runtime issues
in no-signal configurations.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-02-26 20:03:05 +08:00
zhanghongyu
a7567677a8 netdev_driver: add carrier_on to xxx_ifup where carrier_on is absent
since the judgment for network card selection was changed from IS_UP to
IS_RUNNING, drivers that lack carrier_on need to add the carrier_on
operation; otherwise, network access issues will occur.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-02-02 13:23:05 +08:00
Bartosz Wawrzynek
585d954d0b boards/sim: Fix watchdog callback
drivers: Fix types and sx127x driver rx
net/pkt: Fix type

Small fixes.

Signed-off-by: Bartosz <bartol2205@gmail.com>
2026-01-23 09:46:02 +08:00
zhanghongyu
fa6c8579dd driver/net: replace net_lock with netdev_lock
modify the code of the adapted protocol stack to avoid deadlocks and the
logic that cannot be protected by locks after modification.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-06 16:08:30 +08:00
Alan Carvalho de Assis
76903ea636 drivers/sx126x: Fix typo in the Kconfig
This is a small fix just to true the github getting the new commits
after running git push -f

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-01-05 14:59:32 -03:00
Alan Carvalho de Assis
cce61ea287 drivers/sx127x: Add RX Timeout support
This commit adds support to fix RX timeout for SX127x, it is done
leaving the RX mode, entering in stanby mode and returning to RX
mode. It is enough to fix the AFC and get communication working
again.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-01-05 14:59:32 -03:00
Alan Carvalho de Assis
667165db46 drivers/sx127x: Move Kconfig and add bitrate options
This commit moves sx127x Kconfig to lpwan/sx127x/ to follow the
same logic used by sx126x and adds the configuration to support
different bitrate (the default 4800 is fine tuned for LORA).

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-01-05 14:59:32 -03:00
Alan Carvalho de Assis
a51e45d5b3 drivers/lpwan: Fix Kconfig SX1276 and SX1262 position
When user was selecting SX1276 the configuration options to this
device was appear below SX1262.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-12-08 10:39:11 +08:00
chao an
87f134cfaa sched/sleep: replace all Signal-based sleep implement to Scheduled sleep
Nuttx currently has 2 types of sleep interfaces:

1. Signal-scheduled sleep: nxsig_sleep() / nxsig_usleep() / nxsig_nanosleep()
Weaknesses:
a. Signal-dependent: The signal-scheduled sleep method is bound to the signal framework, while some driver sleep operations do not depend on signals.
b. Timespec conversion: Signal-scheduled sleep involves timespec conversion, which has a significant impact on performance.

2. Busy sleep: up_mdelay() / up_udelay()
Weaknesses:
a. Does not actively trigger scheduling, occupy the CPU loading.

3. New interfaces: Scheduled sleep: nxsched_sleep() / nxsched_usleep() / nxsched_msleep() / nxsched_ticksleep()
Strengths:
a. Does not depend on the signal framework.
b. Tick-based, without additional computational overhead.

Currently, the Nuttx driver framework extensively uses nxsig_* interfaces. However, the driver does not need to rely on signals or timespec conversion.
Therefore, a new set of APIs is added to reduce dependencies on other modules.

(This PR also aims to make signals optional, further reducing the code size of Nuttx.)

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-10-17 14:05:02 +08:00
simbit18
ee1b6203c3 drivers/wireless/bluetooth: Aligned Cmake with Make
Add
- bt slip driver #14224

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-10-09 19:22:43 +08:00
simbit18
2290999754 drivers/wireless/ieee80211/bcm43xxx/CMakeLists.txt: Aligned Cmake with Make
Add bcm43013, bcm43455  CYW43439 chip #5112 #6430 #6845

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-10-08 15:21:27 -04:00
zhongzhijie1
3d37e85b13 Remove minread para in btuart_read.
In file_read(), asynchronous reading is supported, so partial reads and the minread parameter are no longer needed.

Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2025-07-01 09:06:43 -03:00
zhongzhijie1
4a4ad26474 Support bt H4_ISO packet parsel in bt_uart_shim driver.
In btuart_rxwork, There is no case for parsel HCI data of ISO type, but there are corresponding processes in the SIM and vendor driver code.

Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2025-07-01 09:06:43 -03:00
zhongzhijie1
d81a28097a btuart_read and returned the correct value.
When the nread return value < 0, if the total length ntotal that has been read is > 0, the function returns ntotal; otherwise, it returns the nread error code.

Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2025-07-01 09:06:43 -03:00
zhongzhijie1
386dbfa449 Refactored the btuart_rxwork function to improve data reception stability.
Read as much data as possible initially, then process each packet individually. Defined the read buffer within the structure and added a rx_len variable to indicate the current read offset. After processing each complete packet, leftover data is moved to rxbuf[0] and rx_len is reduced by the length of the processed packet. The next packet process will start from rxbuf[0] after the read ends at new rxbuf[rx_len].

Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2025-07-01 09:06:43 -03:00
Lars Kruse
3ce85ca54e style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
simbit18
ea47f0cf42 [Kconfig]: Fix Kconfig style
Remove spaces from Kconfig files
Add comments
Add TABs

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-05-14 21:15:14 +08:00
Matteo Golin
0cb7bd7f76 wireless/lpwan/rn2xx3: Fix invalid sync word bug.
This commit resolves issue #16009, where a sync word of less than 64
bytes was printed as 0-padded hex. 0-padding is invalid for the RN2xx3
modules, so now it has been removed.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-04-20 16:55:45 -03:00
Chongqing Lei
29da7fc824 wireless/bt_uart: Fix ACL data buffer length verification.
Driver now validates ACL provided buffer length agaist the size of
the data buffer which is defined by CONFIG_BLUETOOTH_UART_RXBUFSIZE.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2025-04-11 15:57:53 +08:00
dongjiuzhu1
cfd359141f fs/drivers: Avoid causing a busy loop in the program due to context switching induced by sem_post.
examples:
There are two threads involved: thread A with a priority of 100 and
thread B with a priority of 101. Here's how they interact:

When thread A releases a semaphore, thread B is scheduled to execute
some code and may reacquire the semaphore. If no other tasks are ready,
thread A will be scheduled to run.
This continuous process can lead to a busy loop.

Thread A:                                                   Thread B:

while (nxsem_get_value(&priv->wait, &semcount) >= 0 &&  <---
       semcount <= 0)                                      |  2)context switch
  {                                  1)contex switch       |
    nxsem_post(&priv->wait);         ------------->     run some code and nxsem_wait again
  }

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-03-17 10:44:26 +01:00
Matteo Golin
c009c386cc drivers/wireless/lpwan/rn2xx3: Fix SERIAL dependency
There is no 'UART' symbol to depend on, so this is updated to the
correct symbol, SERIAL.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-03-15 13:31:33 +01:00
Matteo Golin
b9b505a2b2 wireless/lpwan: Add support for the RN903 and RN2483 family of LoRa
radio transceivers. This initial support includes transmit and receive
functionality and configuration and reading of radio parameters like
frequency and bandwidth.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-03-06 06:10:19 -03:00
Kevin Witteveen (MartiniMarter)
20ed2e689c drivers/wireless/lpwan/sx126x:
[Experimental]
This adds a driver for the SX126x (SX1261 and SX1262) LoRa chips.
All functions and definitions are coming directly from the DS SX1261-2 V2.1 datasheet.

Signed-off-by: Kevin Witteveen (MartiniMarter) <kevinwit1999@gmail.com>
2025-02-27 16:03:18 -03:00
Daniel Jasinski
9e64505f8d build: CMake fix for sim:btuart
bt_bridge.c file was missing in nuttx/drivers/wireless/bluetooth.

Signed-off-by: Daniel Jasinski <jasinskidaniel95szcz@gmail.com>
2025-01-27 08:24:37 +08:00
Huang Qi
cfd0cc0d1a Remove duplicate includes across multiple files
This commit cleans up redundant header file includes throughout the codebase.
 The changes include:

 - Removing duplicate #include directives that were present in the same file
 - Consolidating includes that were split across multiple lines unnecessarily
 - Removing unused includes that were no longer needed
 - Fixing some formatting issues with includes

 The changes improve code organization and maintainability by:
 - Reducing unnecessary dependencies
 - Making include dependencies more explicit
 - Following consistent include patterns
 - Removing dead code

 No functional changes are made - this is purely a code cleanup commit.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-09 23:30:23 +08:00
hujun5
8411a97b85 use small lock in following files
arch/xtensa/src/esp32s3/esp32s3_rtc_lowerhalf.c
arch/z16/src/z16f/z16f_serial.c
arch/z80/src/z8/z8_serial.c
boards/arm/max326xx/max32660-evsys/src/max326_button.c
boards/arm/stm32/stm32f4discovery/src/stm32_gs2200m.c
drivers/i2c/i2c_bitbang.c
drivers/power/supply/act8945a.c
drivers/serial/uart_pci_16550.c
drivers/serial/uart_pl011.c
drivers/wireless/bluetooth/bt_uart_shim.c

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-22 18:43:26 +08:00
zhangyuan29
dcea1b90e7 arch_atomic: only support atomic_xx and atomic64_xx function
Modify the kernel to use only atomic_xx and atomic64_xx interfaces,
avoiding the use of sizeof or typeof to determine the type of
atomic operations, thereby simplifying the kernel's atomic
interface operations.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-04 14:03:14 +01:00
simbit18
7df0e945ad Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
Replace help => ---help---
Remove extra TABs
Add comments
2024-11-20 16:45:40 -03:00
Alin Jerpelea
286d37026c drivers: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-11-06 18:02:25 +08:00
ouyangxiangzhen
17c51c0667 userspace: Exclude nuttx/arch.h
This patch fixed userspace headers conflict. Architecture-related definition and API should not be exposed to users.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-11-01 16:59:37 +08:00
ligd
4845b9e6e5 bluetooth: fix bt missing header files nuttx/wqueue.h
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-23 20:10:43 +08:00
Xiang Xiao
24cb8c25ab bluetooth: Fix the incompatibility made by https://github.com/apache/nuttx/pull/14224
that pr requires chip turn on CONFIG_DRIVERS_BLUETOOTH to use bluetooth,
but not all defconig enable this option, so let's map bt_driver_register
to bt_netdev_register in header file in this case, and revert the unnessary
change in the related chip and board folders.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-18 09:05:54 +08:00
chengkai
6aeb2e2996 Add space before error, bt_driver_register_internal not trigger error, add defconfig DRIVERS_BLUETOOTH.
Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
fangzhenwei
d97b715e5c drivers: append bt_driver.c to bluetooth drivers Cmakelist.
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2024-10-17 18:09:32 +08:00
duqunbo
dfbeba3536 filter redundant hci reset commands due to dual Bluetooth protocol stacks
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2024-10-17 18:09:32 +08:00
wangzhi7
8b68f9d816 [bt_uart.c] fix bug:cant receive data
rootcause: in btuart_rxwork, read data in blocking mode and btuart_read do three times, maybe remote send some packets one time,so it wont read the sencond packets.

Signed-off-by: wangzhi7 <wangzhi7@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
772807c50f bluetooth: add bt_driver_register interface
add bt_driver_register interface, which could handle
these cases:bth4 bth5 btbridge btslip and btuart_lowerhalf_s etc.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
3144971704 bluetooth: extract btuart_register interface
add btuart_create interface, which would be more
flexible in complex cases. And extract btuart_register interface.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
cae60fb4a0 bluetooth: increase HCI RX buffer size.
BLUETOOTH_MAX_FRAMELEN  buffer size is only for LE only mode.
then we need to increase HCI buffer size in BR/EDR and LE mode.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
aeb3051aba bluetooth: fix bt_slip_send would always block
rootcause: semcount maybe zero when nxsem_wait_uninterruptible

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
00eb8f6461 bluetooth: remove noblock mode handle
rootcause: move block and noblock handle to BTH4 handle.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
3fb63c20d4 bluetooth: fix packet pointer may refer to null
rootcasue: when packet is null, packet var in for loop would
refer to null memory.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
cuiziwei
a55d62f477 gnu++20:fix build warning to [-Wmaybe-uninitialized].
17:10:41  wireless/bluetooth/bt_slip.c:300:7: error: 'byte' may be used uninitialized [-Werror=maybe-uninitialized]
17:10:41    300 |       wlerr("err: invalid escape byte %x\n", *byte);
17:10:41        |       ^
17:10:41  wireless/bluetooth/bt_slip.c: In function 'bt_slip_receive':
17:10:41  wireless/bluetooth/bt_slip.c:766:11: note: 'byte' was declared here
17:10:41    766 |   uint8_t byte;
17:10:41        |           ^~~~

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
65fdc5548e bluetooth: add slip SLIP_ESC case break
H5 SLIP_ESC magic payload whould be encode with
SLIP_ESC and SLIP_ESC_ESC

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
af843eb798 bluetooth: check work_available with retxworker
retxworker would delay when there are many tx hci data

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
946dad5ff0 bluetooth: add nxmutex_lock check
Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00