Commit graph

42249 commits

Author SHA1 Message Date
Gerard Marull-Paretas 2ece951c1b drivers: pwm: stm32: fix polarity setting
PWM polarity was not being set correctly because flags were not checked
correctly.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-07-07 15:09:03 +02:00
Marcin Niestroj 68d0042138 drivers: console: gsm_mux: fix timeout after timeout API change
New timeout API uses opaque k_timeout_t type. Adjust code to work with
that properly.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-07 15:08:43 +02:00
Johann Fischer cfe0a688b2 boards: fix SPI GPIO CS, display and link_board_eth
Since commit 5963ebaf33
("drivers: spi: CS configuration through devicetree")
the SPI GPIO CS flags are obtained from DT,
but the patch series has missed the necessary changes
in the device trees for displays and link_board_eth.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-07 15:08:16 +02:00
Johann Fischer d261de8960 drivers: dw1000: fix SPI GPIO CS
Since commit 5963ebaf33
("drivers: spi: CS configuration through devicetree")
the SPI GPIO CS flags are obtained from DT,
but the patch series has missed the necessary changes
for the ieee802154_dw1000 driver and decawave_dwm1001_dev board.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-07 15:08:16 +02:00
Abhishek Shah 585d6d806c soc: arm: viper: Add PCIe highmem OB memory in MMU table
Add and mark PCIe highmem outbound memory as nGnRnE device memory
in Viper SoC MMU configuration.
Increase VA/PA bits to 36-bits to support the same.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-07-07 15:07:51 +02:00
Sandeep Tripathy b37ce93979 drivers: timer: fix tickless contineous interrupts
K_FOREVER/INT_MAX number of ticks needs delay cycles value of
maximum order and exceeds 'int32' range.
The typecast to 'int32' results in wrongly evaluating the value
as less than 'MIN_DELAY' and chooses 'MIN_DELAY' over the actual
delay cycles.

Cap the 'MAX_TICKS' to INT32_MAX.

fixes: #26632
Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-07-07 15:06:55 +02:00
Robert Lubos c5132aac18 net: lwm2m: Fix invalid logical and operator usage
Binary and should be used instead.

Fixes #26356.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-07 15:06:22 +02:00
Peter Bigot 1688f8c740 samples: nrf: system_off: show how to disable deep sleep
Due to a long standing difference of requirements enabling deep sleep
will by default cause any application that delays for an unbounded
period to power down.  On Nordic doing so turns the system off.  Show
how to prevent this from happening while still allowing deep sleep
states to be available for the application's controlled use.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-07 15:06:08 +02:00
Vinayak Kariappa Chettimada 2b45736f28 Bluetooth: controller: Add Periodic Advertising HCI integration
Add implementation to integrate the HCI Periodic Advertising
interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-07 15:04:51 +02:00
Tyler Hall 62a13fb03b drivers: eeprom_at2x: guarantee retry until timeout
Make sure to retry at least once after the timeout elapses. Sample the
current time before starting the i2c transaction, and only give up if
the polling occurred after the timeout.

The timeout exists to allow the eeprom time to complete a write, during
which time it will nack transactions (at24) or the status register will
report busy (at25). If a transaction fails legitimately, but the 1ms
sleep overshoots the timeout expiration, we will not try again, which
fails to give the part the full grace period before declaring failure.

This is likely to happen in the last 1ms interval but also possible if
the eeprom thread is preempted. It is possible to only try once and give
up if the sleep lasts longer than the timeout, which fails to give the
part an adequate period to complete the write.

Waiting until the current time is after (not equal to) the timeout is
also important because we don't want to round up partial milliseconds if
the start time was sampled near the end of a millisecond boundary. The
timeouts of eeproms can be ~5ms.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
2020-07-07 15:04:31 +02:00
Erwan Gouriou 41279af8a4 actions: get labeler adding "area: Shields" labels
Update labeler action script to treat Shields label.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-07-07 07:53:35 -04:00
Erwan Gouriou dce698c496 actions: get labeler adding "platform: STM32" labels
Update labeler action script to treat stm32 label.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-07-07 07:53:35 -04:00
Robert Lubos 2eb633d12e net: lwm2m: Reset only messages owned by lwm2m context
The context should only clear messages it owns, not all of them. Since
both context (LwM2M and FOTA) share common message pool, they might
interrupt their operation otherwise (i. e. cancel retransmissions).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-06 18:01:31 -04:00
Robert Lubos 8b22521b6b net: lwm2m: Close FOTA socket when finished
The FOTA socket was not closed when download finished or an error
occured.

Additionally, fix the socket fd verification (it was assumed 0 is not a
valid fd which is not correct).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-06 18:01:31 -04:00
Alexandre Bourdiol 937482b4a7 net: ip: copy to wrong destination in z_vrfy_net_addr_pton()
In function z_vrfy_net_addr_pton(),
the final copy should be to 'dst' variable not to 'src'

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-07-06 18:00:07 -04:00
Robert Lubos 3ea5c2180a net: lwm2m: Prevent infinite loop in do_write_op_tlv function
In case unsopported TLV type or malformed packet is received, the
`do_write_op_tlv` function will end up in an infinite loop. Prevent that
by returning an error code in case it does not recognize TLV type.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-06 17:57:40 -04:00
Marcin Niestroj 03c774e58c net: l2: ppp: drop ppp_context's is_network_up
There is already a variable 'network_protos_up', which stores number of
network protocols being up. Additionally each network protocol has its
own state represented by is_ip{,v6}cp_up. Use the latter in FSM up() and
down() callbacks.

This fixes a case when both IPCP and IPv6CP protocols are going
down. When using ctx->is_network_up only one of them (the first) was
deinitialized correctly, second stayed always up (at least partially,
e.g. not calling ppp_network_down()).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-06 17:55:44 -04:00
Alexandre Bourdiol ab1a306a84 tests: lib: mem_alloc: restrict newlib config to more than 16K RAM
This test fails for newlib configuration,
for nucleo_f030r8 which has only 8K of RAM.
But each step of the test is successfull when executed solely
or with smaller buffer size.
Note: test is working on nucleo_f091rc which has larger RAM (32K)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-07-06 17:24:02 +02:00
Marcin Niestroj 16542e1642 net: l2: ppp: fix packet length for sending Term-Req and Term-Ack
Each PPP packet sent on wire needs to have at least 4 bytes length. Set
that length for outgoing Term-Req and Term-Ack packets. Also update
length validation to check for at least 4 bytes instead of at least 1
byte.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-06 16:50:54 +02:00
Joakim Andersson c3308275f6 Bluetooth: GATT: Turn GATT notify multiple feature default off
Turn the GATT notify multiple feature off as default value.
This feature changes the behavior of the bt_gatt_notify API in a way
that might not be backwards-compatible.
This is because the notify multiple header is larger, and therefore
limits the amount of bytes that could otherwise have been sent in a
normal notify PDU for a given ATT MTU.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 16:50:36 +02:00
Joakim Andersson 1d27450954 Bluetooth: host: Fix conn_handle in LE Advertising Set Terminated evt
Fix use of conn_handle in LE Advertising Set Terminated event not
converting from serial Little Endian to native CPU endianness.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 16:49:28 +02:00
Vinayak Kariappa Chettimada 6adfc9bfba Bluetooth: controller: Fix Periodic Adv Data Set parameter list
Fix the parameter list of Periodic Advertising Data Set
interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-06 16:49:19 +02:00
Andrzej Głąbek 414c773c48 drivers: gpio_nrfx: Replace atomic_set_bit_to() with atomic_and()
A call to atomic_set_bit_to() was used for clearing bits in an atomic_t
variable that stores information about allocated GPIOTE channels.
This caused an issue to be reported by Coverity, as the function treats
its first parameter as an array and it was provided with a pointer to
a singleton.
This commit replaces that call with atomic_and(), to prevent the issue
from being reported and for consistency with the way bits are set for
allocated GPIOTE channels (what is done with a call to atomic_or()).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-07-06 16:47:03 +02:00
Ioannis Glaropoulos 4f297c72d3 doc: contribute/modifying_contributions: minor typo fix
Fix a typo in modifying_contributions.rst.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-07-06 10:44:18 -04:00
Andrzej Głąbek 5f6985ce64 drivers: uart_nrfx_uart: Fix disabling of TX IRQ
The STOPTX task cannot be triggered directly in the function that
disables TX interrupt because this task stops the UART transmitter
immediately, even if it is in the middle of shifting out a byte.
Instead, this task needs to be triggered in the interrupt handler,
when the end of transmission is signaled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-07-06 16:34:53 +02:00
Øyvind Rønningstad 4813f469f0 sanitycheck: Improve handling of duplicate devices
Some devices have multiple serial ports, which show as duplicates in the
hardware map. This doesn't work well when using --generate-hardware-map
to regenerate an existing map. E.g. nrf5340pdk_nrf5340_cpuapp by default
prints to the 3rd of 3 devices. If it shows up on /dev/ttyACM0,
/dev/ttyACM1, and /dev/ttyACM2, printout will come on /dev/ttyACM2.
nrf9160dk_nrf9160 also provides 3 devices, but prints to the 1st.

This patch sorts the devices by the serial port and matches multiple
duplicate entries one-to-one to retain the ordering. This way, the
correct device can be given the platform name and the others can be kept
as "unknown" so that --device-testing understands correctly
1) that there is only one device (not 3)
2) where the serial output will come.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-07-06 10:27:22 -04:00
Michael Hope e68287dd90 drivers: spi: fix the fast path on the SAM0 driver
To keep the bus fully loaded, the SAM0 has a fast path that recognises
special cases like TX only, RX only, or TX/RX of the same size.
Commit #ea2431f32f7 accidentally disabled this.

This increases the utilisation from around 30 % to around 90 % at 48
MHz.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-06 10:02:14 -04:00
Michael Hope 8181eede5d drivers: spi: ensure the first byte has been loaded in the TX fast path
The SAM0 has a data register and a shift register.  Data that is
written to the data register is transferred to the shift register by
the peripheral.

On the SAMD51, the CPU is fast enough that the first data write hasn't
been transferred to the shift register by the time the next data write
occurs, causing the second write to be dropped, causing the receiver
to wait forever.

Fix by spinning until the data register is empty.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-06 10:01:35 -04:00
Michael Hope dcf64c93e3 drivers: usb: switch the SAM0 driver from a custom allocator to the heap
Also automatically enable the heap if the USB device is selected.

Part of #23178

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-06 09:58:20 -04:00
Andreas Sandberg 8e8f14e333 drivers: lora: Add chip select flags to SX1276 driver
Add chip select flags from the device tree to the spi_cs_control
instance.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-06 09:57:45 -04:00
Andreas Sandberg 33d473d281 drivers: lora: Add chip select flags to SX126x driver
Add chip select flags from the device tree to the spi_cs_control
instance.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-06 09:57:45 -04:00
Tobias Schaffner 667f1e663d drivers: gd7965: use K_MSEC macro in k_sleep calls
The gd7965 driver still called ksleep with unsigned integers.
Use the K_MSEC makro instead.

Signed-off-by: Tobias Schaffner <tobiasschaffner87@outlook.com>
2020-07-06 09:57:14 -04:00
Parthiban Nallathambi 3e62d73368 drivers: wifi: eswifi: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.
ISM43362 chip select is ACTIVE_LOW.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-06 08:24:18 -05:00
Andreas Sandberg d6f22e53eb boards: arm: b_l072z_lrwan1: Add flash support
The STM32L0 now has a working flash driver, enable the flash device on
the b_l072z_lrwan1.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-06 08:18:35 -05:00
Joakim Andersson 4f7505cb10 Bluetooth: host: Unspecified disconnect reason for no pending conn
Use an unspecified reason when disconnecting a connection that did not
have a pending connection in the host.
We don't allocate connection objects in the connection complete anymore
so using memory-capacity-exceeded is misleading.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 14:39:30 +02:00
Joakim Andersson 4281843fd7 doc: relnotes: Add release notes for updated HCI driver event handling
Add release notes for updated HCI driver event handling for calling the
bt_recv() and bt_recv_prio() functions when delivering HCI events to
the host.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
Joakim Andersson a52c442fc7 Bluetooth: test: Print disconnect reason in hex value
Print the disconnect reason in hex value since the defines are in hex.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
Joakim Andersson 52f9c0dd46 Bluetooth: host: Fix resume advertiser race condition
This patch fixes an issue with the advertiser not resuming connectable
advertiser if the last bt_conn_unref happens from something other
than the disconnected callback.
In this case this last bt_conn_unref was from gatt.c notify_cb called
from application main thread.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
Joakim Andersson 4be66bd33d Bluetooth: Fix host RX thread deadlock
Fix host RX thread being deadlocked. The deadlock occurs because the
RX thread is stuck waiting in conn_tx_alloc with K_FOREVER but if the
connection is disconnected only the RX thread can unblock it in the
handling of the disconnect event.

This commit fixes this deadlock by splitting the processing of the
disconnected event into two parts.
The part needed to unblock the RX is to release resources held by
unack'ed TX packets and mark the connection state as not connected
anymore.
The RX thread waiting for free_tx fifo and the TX thread waiting for
the bt_dev.le.pkts semaphore will both check the connected state after
having acquired them and will abort if disconnected.
The rest of the processing will be handled at normal RX thread
priority like normal.

Move the bt_recv_prio handling to the Bluetooth host when the host
has defined its own RX thread (CONFIG_BT_RECV_IS_RX_THREAD=n).
If the HCI driver has the RX thread (CONFIG_BT_RECV_IS_RX_THREAD=y),
then the responsibility to call bt_recv and bt_recv_prio correctly
falls to the HCI driver.
The helper function bt_hci_evt_is_prio() is replaced with
bt_hci_evt_get_flags() so that the HCI driver can do this correctly.
This decision to replace was made so that existing HCI drivers
maintained out-of-tree will fail at compile time with the new system.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>

Bluetooth: host: Move bt_recv_prio to host when RX thread is defined

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
Ilya Tagunov 897b5bf60a boards: nucleo_f070rb/f303re: fix clock configuration
Fix PREDIV1 options in defconfigs.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2020-07-05 07:56:21 -04:00
Ilya Tagunov 301208329b drivers: clock_control: stm32f0/f3: streamline PREDIV handling
We should not set PLLSRC bits here. It is done by
LL_PLL_ConfigSystemClock_* functions which are called later.
Also, PREDIV1 setting should not be restricted to HSE only.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2020-07-05 07:56:21 -04:00
Ilya Tagunov 907c545837 drivers: clock_control: stm32f0/f3: fix PREDIV options
Allow CLOCK_STM32_PLL_PREDIV1 option for STM32F3 series;
correct and extend option descriptions.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2020-07-05 07:56:21 -04:00
Gerson Fernando Budke c001baafc8 boards: arm: atsamr21_xpro: Add PWM support
This enables PWM and connects it to the LED0.  Tested with blinky_pwm
and fade_led samples.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-07-04 15:13:28 -04:00
Gerson Fernando Budke c5d7679025 boards: arm: atsamr21_xpro: Fix yaml supported list order
Index supported list order by name.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-07-04 15:13:28 -04:00
Gerson Fernando Budke 460791278e dts: arm: atmel: samr21: Add TCC peripherals
Add TCC peripherals entries for SAMR21 SoC.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-07-04 15:13:28 -04:00
Dominik Ermel 5a40ff1ac5 posix/fs: Fix POSIX lseek to return position upon completion
Bring standard behaviour to lseek, where new file position is returned
on success.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-07-04 07:46:51 -04:00
Stephanos Ioannidis 17e8a20615 boards: atsame54_xpro: Support driving on-board LED with PWM
This commit adds the PWM LED definition in the board device tree for
the on-board LED connected to the pin PC18.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-07-04 07:09:28 -04:00
Stephanos Ioannidis 11c294d626 soc: arm: samd5x: Add device tree TCC definitions
This commit adds the device tree TCC (Timer/Counter for Control
Applications) peripheral definitions for the Atmel SAM D5x and E5x
series SoCs.

The SAM D5x/E5x series SoCs have five instances of the TCC peripheral:

TCC#  Channels  Waveform Output  Counter Size
 0       6             8            24-bit
 1       4             8            24-bit
 2       3             3            16-bit
 3       2             2            16-bit
 4       2             2            16-bit

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-07-04 07:09:28 -04:00
Xavier Chapron a94c8bb02b net: buf.h: Add static initialiser to net_buf_struct
This is necessary to avoid collision between drivers that calls
NET_BUF_POOL_DEFINE with the same name.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-07-04 07:08:33 -04:00
Andrzej Puzdrowski c7ab1a178c Kconfig: update BOOTLOADER_MCUBOOT help message
Description was updated so reflects fact that this
option activates SW_VECTOR_RELAY_CLIENT feature now.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-07-03 13:34:50 -04:00