Commit graph

10700 commits

Author SHA1 Message Date
Gerard Marull-Paretas
d9a5a220b7 samples: s/CONFIG_BOARD_ENABLE_CPUNET/CONFIG_SOC_NRF53_CPUNET_ENABLE/
CONFIG_BOARD_ENABLE_CPUNET is deprecated.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-08-01 08:56:56 +01:00
Emil Gydesen
1b83555d4c Samples: Bluetooth: CAP Initiator broadcast support
Add broadcast support to the CAP initiator sample.

This adds new sample-specific Kconfig options to help
select the right Kconfig options based on whether
unicast, broadcast or both is being used.

This also moves common TX functionality
to cap_initiator_tx to reuse the same TX thread
and functionality.

Finally there is a babblesim implemented for
the broadcast. There is not broadcast support for the
CAP acceptor sample yet, so this test only verifies that we
get the TX complete events from the controller.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-08-01 08:53:08 +01:00
Rubin Gerritsen
a4e43d013c Bluetooth: Samples: Use string printing functions for error codes
When developing Bluetooth applications, you typically run into some errors.
If you are an experienced Bluetooth developer, you would typically know
how to translate the error codes into string representations.
Others might not.

This commit to adds string printing of error codes for all
samples to make them more user-friendly.

Several formatting alternatives were considered. The chosen alternative
balances code readability and FLASH size (with and without string
printing).

Example output from the peripheral_hids sample when the
peer rejects pairing:

```
Bluetooth initialized
Bluetooth authentication callbacks registered.
Advertising successfully started
Connected 5E:67:02:D3:1C:DB (random)
Security failed: 5E:67:02:D3:1C:DB (random) \
level 1 err 6 BT_SECURITY_ERR_PAIR_NOT_ALLOWED
Disconnected from 5E:67:02:D3:1C:DB (random), \
reason 0x13 BT_HCI_ERR_REMOTE_USER_TERM_CONN
```

Other alternatives that were considered:

- Use of parantheses:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err BT_SECURITY_ERR_PAIR_NOT_ALLOWED(6)
Disconnected from 5E:67:02:D3:1C:DB (random), reason \
BT_HCI_ERR_REMOTE_USER_TERM_CONN(0x13)
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err (6)
Disconnected from 5E:67:02:D3:1C:DB (random), reason (0x13)
```

- Spaces and parantheses:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err BT_SECURITY_ERR_PAIR_NOT_ALLOWED (6)
Disconnected from 5E:67:02:D3:1C:DB (random), \
reason BT_HCI_ERR_REMOTE_USER_TERM_CONN (0x13)
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err  (6)
Disconnected from 5E:67:02:D3:1C:DB (random), reason  (0x13)
```

- Parantheses around everything:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err (BT_SECURITY_ERR_PAIR_NOT_ALLOWED(6))
Disconnected from 5E:67:02:D3:1C:DB (random), \
reason (BT_HCI_ERR_REMOTE_USER_TERM_CONN(0x13))
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err ((6))
Disconnected from 5E:67:02:D3:1C:DB (random), reason ((0x13))
```

- Error code first, then string representation:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err 6 (BT_SECURITY_ERR_PAIR_NOT_ALLOWED)
Disconnected from 5E:67:02:D3:1C:DB (random), reason \
0x13 (BT_HCI_ERR_REMOTE_USER_TERM_CONN)
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err 6 ()
Disconnected from 5E:67:02:D3:1C:DB (random), reason 0x13 ()
```

- Apostrophes around error printing:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err "BT_SECURITY_ERR_PAIR_NOT_ALLOWED (6)"
Disconnected from 5E:67:02:D3:1C:DB (random), reason \
"BT_HCI_ERR_REMOTE_USER_TERM_CONN (0x13)"
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err " (6)"
Disconnected from 5E:67:02:D3:1C:DB (random), reason " (0x13)"
```

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-31 12:56:11 +02:00
Fabio Baltieri
716fa268f4 input: add a user_data pointer to the callback
Add a void *user_data pointer to the input callback structure. This is
useful for driver to get back the driver data structure and avoid
defining wrapper functions.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-31 12:55:11 +02:00
Jonathon Penix
4ddd3ebd51 samples: external_lib: Include --target in exported build flags
Appropriately setting the `--target` flag is necessary when using clang
and building for a target other than the default. Zephyr generally
accomplishes this by setting the CMAKE_<LANG>_COMPILER_TARGET variables and
allowing cmake to automatically provide the `--target` flag when building.

For the external_lib sample, however, cmake can't add the flag and it was
not otherwise exported. As such, clang typically threw errors when building
this sample for any non-default targets due to mismatches between
target-specific flags and the default target.

To fix this, ensure we select the correct target by checking if
CMAKE_C_COMPILER_TARGET has been defined and adding
`--target=<triple>` to the list of flags that are exported if so.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-07-31 10:08:33 +02:00
Filip Kokosinski
81cb80d923 samples/synchronization: fix thread b pinning
This commit adds a brief thread b suspend while the sample sets its
affinity mask.

If the call to `k_thread_cpu_pin` is being made while the thread is
actively running, then we get `-EINVAL` and the affinity mask is left
unchanged.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2024-07-30 18:30:30 +01:00
Fabio Baltieri
2455291da8 samples: button: add a note about the input subsystem and samples
The button sample is really a gpio interrupt sample, one may easily miss
the debounced driver and think it's not provided.

Add a note in the basic button sample documentation to refer to the
input subsystem doc and sample.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-30 18:29:50 +01:00
Krzysztof Chruściński
fb2d9ecde5 samples: zbus: work_queue: Enable synchronous printk
twister expects regex print from logging used in the sample. Sample
is using minimal logging which does not protect against logs being
interleaved if printed from various contexts. Minimal logging is
just mapping of logging API to printk. Add CONFIG_PRINTK_SYNC to
ensure that printing of each log is synchronous (with lock) and
logs are never interleaved.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-07-30 18:27:40 +01:00
Murali Karicheri
05643e700e samples: drivers: flash_shell: allow run on stm32h745i_disco/stm32h745xx/m4
Now that flash controller driver is supported on M4 of stm32h745i_disco,
remove it from platform_exclude list and add an overlay for flash_shell
sample.

Signed-off-by: Murali Karicheri <murali.karicheri@sandc.com>
2024-07-30 18:26:20 +01:00
Murali Karicheri
4e0b02ef66 samples: drivers: flash_shell: allow run on stm32h747i_disco/stm32h747xx/m4
Now that flash controller driver is supported on M4 of stm32h747i_disco,
remove it from platform_exclude list and add an overlay for flash_shell
sample

Signed-off-by: Murali Karicheri <murali.karicheri@sandc.com>
2024-07-30 18:26:20 +01:00
Johann Fischer
67caae3aca usb: device_next: introduce UDC_BUF_POOL_*_DEFINE macros
Introduce UDC_BUF_POOL_*_DEFINE macros based on NET_BUF_POOL_*_DEFINE
macros but use our own version of alloc and unref callbacks to get
buffers with specific alignment and granularity. Also, do not use ref
callback because it breaks alignment.
Also introduces helper macros for defining and checking UDC
driver-compliant static buffers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-30 18:26:04 +01:00
Miguel Gazquez
f6f03867d8 samples: accel_polling: set sampling frequency when necessary
The accel_polling sample uses various sensor, but doesn't set a sampling
rate. But some sensors (like st,lsm6dso) have a default sampling
frequency of 0. So, depending on the sensor, the sample may not always
work.

There are two ways to fix this: either all drivers must set a valid
sampling rate, or the sample shall at least try to set a value if there
is none.

We propose here the second approach, wich should allow the sample to
work on more sensors out of the box.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2024-07-29 14:21:24 +02:00
Ayush Singh
99d6a82d5b samples: drivers: adc: Add beagleconnect freedom overlay
- Add support for beagleconnect freedom

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2024-07-29 14:18:39 +02:00
Anke Xiao
c6f5aad754 samples: drivers: i2c: target_eeprom: add frdm_ke17z support
Added i2c configuration to test target_eeprom case for frdm_ke17z
Added `sample.drivers.i2c.target.kinetis` in sample.yaml for frdm_ke17z
and frdm_ke17z512 automatically run the tests

Signed-off-by: Anke Xiao <anke.xiao@nxp.com>
2024-07-29 14:14:23 +02:00
Jamie McCrae
5646e15f9a samples: sysbuild: hello_world: Add support for nrf54l15pdk
Adds support for building this sample for the nrf54l15pdk board

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-07-29 14:13:48 +02:00
Tim Sørensen
86032bcf85 bluetooth: avoid USB starvation in bap_broadcast_sink
fix to ensure that USB audio interface is not starved when
no audio data is received over bluetooth.

Signed-off-by: Tim Sørensen <tims@demant.com>
2024-07-29 14:13:10 +02:00
Adrien Leravat
8d81554c42 samples: tfm_integration: tfm_ipc: update readme
Updates the output sample to more closely resemble the output for a
recent Zephyr version (current was v1.14). Fixes #76275.
Updates broken tf-m documentation link to their new URL.

Signed-off-by: Adrien Leravat <adrien.leravat@gmail.com>
2024-07-29 14:13:02 +02:00
Jukka Rissanen
f6b10bb7ac samples: net: zperf: Start DHCPv4 when needed
If config library is disabled but DHCPv4 client is enabled,
then start DHCPv4 when zperf application starts.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-07-28 07:30:12 +03:00
Emil Gydesen
8be6db67fc Bluetooth: ISO/BAP: Refactor BIS bitfield
Refactors teh BIS bitfield values used for ISO
and BAP.

Previously BIT(1) meant BIS index 1, which was a Zephyr choice
in the early days of ISO, as the BT Core spec did not use
a bitfield for BIS indexes.

Later the BASS specification came along and defined that
BIT(0) meant BIS index 1, which meant that we had to shift BIS
bitfields between BAP and ISO.

This commit refactors the ISO layer to use BIT(0) for Index 1 now,
which means that there is no longer a need for conversion
between the BAP and ISO layers, and that we can use a value
range defined by a BT Core spec (BASS).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-07-27 15:19:46 +03:00
Olivier Lesage
de147d1ce8 samples: bluetooth: minor logging changes in PAwR samples
Some minor logging improvements based on my user experience

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-07-27 15:14:37 +03:00
Olivier Lesage
94d86b9501 samples: bluetooth: fix periodic_sync_rsp sample connection
Was broken after BT_LE_ADV_OPT_USE_NAME and
BT_LE_ADV_OPT_FORCE_NAME_IN_AD were deprecated.

The periodic_adv_rsp sample
looks for the string "PAwR sync sample" and connects based on that.

So, the periodic_sync_rsp sample needs to advertise this string.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-07-27 15:14:37 +03:00
Jordan Yates
56343079a4 samples: bt: ext_adv: don't terminate invalid conn
If the remote side has already terminated the connection (or the
connection failed to establish), don't attempt to terminate an invalid
connection object. Instead, start advertising again immediately.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-27 15:07:55 +03:00
Johann Fischer
28b2051bda usb: device_next: add support for configuration string descriptor
Change USBD_CONFIGURATION_DEFINE macro to take the address of a string
descriptor node as an argument. This is a breaking change for macro
users, but quite convenient and easy to implement.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-27 15:06:09 +03:00
Jamie McCrae
db5a5fa109 samples: tfm_integration: psa_crypto: Disable sample
Disables running this sample as doing so requires qcbor, which
is not apache licensed

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-07-27 10:48:23 +03:00
Anke Xiao
e22b533818 samples: subsys: fs: littlefs: add ke17z littlefs test support
Update sample.yaml allows frdm_ke17z and frdm_ke17z512 to test littleFs.

Signed-off-by: Anke Xiao <anke.xiao@nxp.com>
2024-07-27 10:39:32 +03:00
Armando Visconti
878b5a9d2e samples/shields: x-nucleo-iks4a1: Add lsm6dsv16x temp display
Extended the x-nucleo-iks4a1 shield standard sample adding lsm6dsv16x
sensor die temperature display.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-07-27 10:37:11 +03:00
Benjamin Cabé
c25ee8bb38 doc: shields: make section IDs consistent with shield name
Convention is to name RST section the same as the shield

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-07-20 10:18:54 +02:00
Swift Tian
45d39f3b7c samples: drivers: mspi: Update readme doc
Update mspi samples readme to match with code and release doc.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2024-07-18 09:32:29 +02:00
Tom Burdick
9f85a70a04 doc: Revamp sensor docs
Docs now start at a high level, discussing sensors, attributes,
channels, and reading data from them.

Followed by more detailed usage guides in how to solve common problems
sensor users may run into.

Additionally renames the sensor_api sphinx tag to sensor

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-07-16 16:49:24 -04:00
Jordan Yates
46167e3234 samples: tfm: add build_config sample
Add a sample that can test various TF-M build options. For now we only
test `CONFIG_TFM_BL2=n` and `CONFIG_TFM_MCUBOOT_IMAGE_NUMBER=1`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-12 20:38:49 -04:00
Anas Nashif
ec71e04cdb samples: env_posix: fix regex in sample test
ALERT is empty, so do not try to match any content.

Fixes #72858

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-07-12 09:18:56 -04:00
Gerard Marull-Paretas
b5e5aa3335 samples: ipc: icmsg: fix unbalanced nRF53 cpunet enable calls
It looks like sample called nrf53_cpunet_enable(false) before any
nrf53_cpunet_enable(true), resulting in asserts due to unbalanced calls
(error propagated from onoff service).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-12 09:15:06 -04:00
Gerard Marull-Paretas
e41ab1ab14 samples: drivers: mbox: fix regex when using channels 0/1
The sample will print a ping-pong message indefinitely on both,
application (or main) core and remote core. When twister is run in
device testing mode, only one terminal is evaluated (application), so
the regex just needs to account for the application core output, not
remote.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-12 06:23:52 -04:00
Anas Nashif
47f327f081 tests: add openamp tags to openamp samples
tag samples with openamp.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-07-11 18:53:49 -04:00
Evgeniy Paltsev
67efbf3d57 samples: posix: env: fix failure in case of minimal libc is used
In case of minimal libc we have CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE = 0
by default. Let's set CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE explicitly
so we can allocate memory for environment variables.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-07-11 13:24:02 -04:00
Jonathan Rico
4afe745a1d Bluetooth: host: Add lower bound for CONFIG_BT_BUF_ACL_RX_COUNT
See comment above assert for more.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-07-10 11:47:26 -04:00
Johann Fischer
c9c35fa59f samples: usb: fix API references
Remove references to new device APIs that are not supported by the
samples. Remove the reference to the UART API from the console sample
because it is not really used there, but add it to the CDC ACM sample.
Fix references in HID, MSC and UAC2 samples.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-10 14:36:46 +02:00
Natalia Pluta
c9f9c144e9 samples: net: cellular_modem: fix division by zero in sample_echo_packet
A hard fault occurs when the `sample_echo_packet` function attempts
to print the average time per successful echo and no packets have
been sent, resulting in a division by zero error. This fix adds a check
to ensure that `packets_sent` is greater than 0 before performing
the division. This prevents the system from halting due to a usage fault.

Signed-off-by: Natalia Pluta <pluta.natalia.m@gmail.com>
2024-07-10 11:37:44 +02:00
Jukka Rissanen
794d7cf3c5 net: sockets: Remove async service support
As found in PR #75525, we should not modify the polled fd array
in multiple places. Because of this fix, the async version of
the socket service could start to trigger while it is being handled
by the async handler. This basically means that the async version
cannot work as intended so remove its support.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-07-10 11:36:59 +02:00
Rahul Goyal
74c86928b2 Samples: max17048: added units to output
present sample output does not contain units.
added units to sample output

Signed-off-by: Rahul Goyal <goyalrahul1516@gmail.com>
2024-07-10 11:36:28 +02:00
Thomas Stranger
48e235445b samples: sensor: ds18b20: clearly indicate any errors
Any errors are clearly indicated and program execution
ended.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2024-07-09 15:37:58 -04:00
Guy Morand
0c9858879c samples: logging: disable usermode for some platforms
Those platfroms use rtt as debug port that conflicts with usermode, as
in 27d519b260.

Fixes #75617

Signed-off-by: Guy Morand <guy.morand@bytesatwork.ch>
2024-07-09 15:20:34 -04:00
Johann Fischer
67a31ef2d7 samples: hid-mouse: protect report buffer
Use the message queue to pass the new report from the input callback,
and use a semaphore to protect the report buffer until it is transferred
to the host.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-09 12:05:04 +02:00
Zhaoxiang Jin
599fddc867 tests: Add frdm_mcxn947 into regulator and adc test scope
Add frdm_mcxn947 into regulator and adc test scope

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2024-07-08 14:57:55 -04:00
Alberto Escolar Piedras
65fb6264cb samples/drivers/adc/adc_sequence: Build fix for sam_v71_xult
Fix build error due to cmake requiring a separate
overlay for each of this target's SOCs.

Error being fixed:
```
-- Board: sam_v71_xult, qualifiers: samv71q21
CMake Error at cmake/modules/extensions.cmake:2742 (message):
Board sam_v71_xult defines multiple SoCs.

Shortened file name (sam_v71_xult.overlay) not allowed, use
'<board>_<soc>.overlay' naming
```

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-07-08 14:55:15 -04:00
Johann Fischer
48dd5c9915 sample: usb: allow samples to be built on all platforms with 'usbd'
Replace platform_allow with integration_platforms, what allow CI to
build samples on all platforms with test feature 'usbd' but still limits
number of platforms when it is invoked with the --integration option.
Replace/add some platforms that already have test feature 'usbd'.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-08 12:13:54 -04:00
Jens Rehhoff Thomsen
efddc8723c Bluetooth samples: Broadcast code handling
The broadcast sink sample no longer treats the broadcast_code_received
semaphore as a boolean.

Fixes #75469

Signed-off-by: Jens Rehhoff Thomsen <jthm@demant.com>
2024-07-08 12:12:54 -04:00
Nazar Palamar
b55999d3de samples: bluetooth: exclude cyw920829m2evk_02 from build
exclude cyw920829m2evk_02 from build. For cyw920829m2evk_02
need `west bloobs fetch` (to get BT fw),  which does not
allowed in CI.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-07-08 15:51:21 +02:00
Mark Wang
0141bc0f40 sample: usb: mass: add next device sdcard test case
update the sample.yaml file.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2024-07-08 09:28:41 +02:00
Robert Lubos
e91c47d338 samples: net: zperf: Optimize configuration for better performance
Increase the number of network packets and buffers for better TCP
performance in the sample out-of-the-box.
Decrease the network buffer data size for better buffer management in
the sample (less buffer space wasted for L2 header). The only drawback
of this is reduced TCP TX performance, but less than 2 Mbps in my case.
Finally, enable speed optimizations for another small performance boost.

As the RAM requirements of the sample now increase considerably in the
default configuration, add a note in the readme file about it, and how
to make it fit into smaller boards.

Tested on nucleo_h723zg:
  Before (current defaults):
    UDP      TX          RX
         76.47 Mbps  93.48 Mbps
    TCP      TX          RX
         76.18 Mbps  67.75 Mbps

  After (new defaults):
    UDP      TX          RX
         76.08 Mbps  93.62 Mbps
    TCP      TX          RX
         74.19 Mbps  85.51 Mbps

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-07-06 17:03:01 +02:00