Mark the INT signal to be active low and use the new functions to get
gpio state and configure the gpio interrupt flanks.
Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
Used the SocketCAN initalization code from the can_stm32.c driver which
successfully initializes SocketCAN for the Flexcan driver
Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
This commit introduces the can-primary alias to identify
the primary CAN interface.
This alias is used for all samples and tests, so they don't
need to probe the right interface.
Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
The build infrastructure should not be adding the drivers subdirectory
to the include path. Fix the legacy uses that depended on that
addition.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Update the NXP Kinetis FlexCAN driver to use the initialization
parameters for disabling self-reception and enabling listen-only mode
added in MCUXpresso v2.7.0.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
When loading the TX buffer via SPI only transfer the data bytes of
the CAN message that will be used as defined by the DLC.
Signed-off-by: Nick Ward <nix.ward@gmail.com>
This commit limits the data length code to eight.
DLC > 8 returns a newly introduced CAN_TX_EINVAL error code.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Use this short header style in all Kconfig files:
# <description>
# <copyright>
# <license>
...
Also change all <description>s from
# Kconfig[.extension] - Foo-related options
to just
# Foo-related options
It's clear enough that it's about Kconfig.
The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)
git ls-files '*Kconfig*' | \
xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Clean up space errors and use a consistent style throughout the Kconfig
files. This makes reading the Kconfig files more distraction-free, helps
with grepping, and encourages the same style getting copied around
everywhere (meaning another pass hopefully won't be needed).
Go for the most common style:
- Indent properties with a single tab, including for choices.
Properties on choices work exactly the same syntactically as
properties on symbols, so not sure how the no-indentation thing
happened.
- Indent help texts with a tab followed by two spaces
- Put a space between 'config' and the symbol name, not a tab. This
also helps when grepping for definitions.
- Do '# A comment' instead of '#A comment'
I tweaked Kconfiglib a bit to find most of the stuff.
Some help texts were reflowed to 79 columns with 'gq' in Vim as well,
though not all, because I was afraid I'd accidentally mess up
formatting.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Reduces SPI RX buffer read overhead by a byte and further reduces the
SPI use by automatically clearing the associated receive flag RXxIF.
Signed-off-by: Nick Ward <nix.ward@gmail.com>
This commit extends the CAN API with the following functions:
- can_get_state
- can_recover
- can_register_state_change_isr
This functions can be used to get the error-counters and the state
of the CAN controller. The recover function can be used to recover
from bus-off state when automatic recovery is disabled.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Added in commit 0e807c3f54 ("drivers: can: Add loopback driver"), then
never used.
Found with a script.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Added in commit 0e807c3f54 ("drivers: can: Add loopback driver"), then
never used.
Found with a script.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fix CAN loopback mode in the NXP MCUX FlexCAN driver by only disabling
self-reception when loopback mode was not requested.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Add work-around for the NXP MCUxpresso SDK not exposing APIs for
setting the listen-only (LOM) bit of the FlexCAN MCR register and the
self-reception disable (SRXDIS) bit of the CTRL1 register.
These bits can only be written when the FlexCAN module is in freeze
mode. Add a set of simplified functions (not supporting errata 9595) for
entering/exiting freeze mode.
This work-around can be removed again once the NXP MCUxpresso SDK
exposes the needed functionality.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
The mcux CAN controller uses frame ID and position to calculate the
priority, but the driver expects chronological ordering.
This PR mimics this behavior by only using the last free message box.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
These calls are not accessible in CI test, nor do they get built on
common platforms (in at least one case I found a typo which proved the
code was truly unused). These changes are blind, so live in a
separate commit. But the nature of the port is mechanical, all other
syscalls in the system work fine, and any errors should be easily
corrected.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Adding required fields to the devicetree overlay of the CAN sample as
this is often used as a reference. Also use these fields instead of the
KConfig entries.
Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
The detach function didn't call FLEXCAN_TransferAbortReceive.
The state of the mailbox after detaching was still kFLEXCAN_StateRxData
and therefore a new filter couldn't be attached.
This PR calls FLEXCAN_TransferAbortReceive and releases the mailbox.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
The callback function and callback argument were not set when the
filter is attached, and therefore, the callback function was never
called. This commit sets the function and callback correct.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit adds support for a 6LoCAN Ethernet border translator.
CAN frames with the translator CAN address are translated and forwarded
to Ethernet. Ethernet frames with the first 34 bits matching the MAC
address of the translator are translated and forwarded to 6LoCAN.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is an implementation of 6LoCAN, a 6Lo adaption layer for
Controller Area Networks. 6LoCAN is not yet standardised.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Rename the socket_can implementation from CANBUS to CANBUS_RAW.
This is a preperation for 6LoCAN which is a CANBUS L2 for IPv6.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
TX1 and TX2 buffer empty busy flags would have been cleared only for
TX0 empty interrupts and there would have been extra unwarranted
TX callbacks for TX1 and TX2 if the callbacks had previously been used.
Signed-off-by: Nick Ward <nick.ward@setec.com.au>
This commit implements timestamps for receiving frames on the
NXP MCUX FlexCAN CAN driver.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
This commit introduces a timestamp for received CAN frames.
The timestamp is optional and can be activated via Kconfig.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Implement a CAN shell. With this shell you can send messages,
attach and tetach filters.
Messages that match the attached filters are printed to the shell.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit changes the TX priority from ID based priority to
chronological order. The advantage is that when messages with
the same ID are sent, the order is retained.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Removed the STM32 CAN_Init function and implemented the initialization
in the driver.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move spi.h to drivers/spi.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move gpio.h to drivers/gpio.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move clock_control.h to drivers/clock_control.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move can.h to drivers/can.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move atomic.h to sys/atomic.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Convert DT_.*_GPIO_{CONTROLLER,PIN,FLAGS} ->
DT_.*_GPIOS_{CONTROLLER,PIN,FLAGS)
Used the following commands to make these conversions:
git grep -l DT_.*_GPIO_CONTROLLER | xargs sed -i 's/DT_\(.*\)_GPIO_CONTROLLER/DT_\1_GPIOS_CONTROLLER/g'
git grep -l DT_.*_GPIO_PIN | xargs sed -i 's/DT_\(.*\)_GPIO_PIN/DT_\1_GPIOS_PIN/g'
git grep -l DT_.*_GPIO_FLAGS | xargs sed -i 's/DT_\(.*\)_GPIO_FLAGS/DT_\1_GPIOS_FLAGS/g'
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add support for Kinetis MK64 series.
Interrupts are adapted because MK64 has other interrupts than KEx1F.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>