micropython/ports
Herwin Grobben 160e4d9a6d stm32/fdcan: Fix FIFO1 usage and handling of error interrupts.
The original code used a independent state with regards to the interrupt.
During heavy bus error conditions the internal state could become
out-of-sync with the interrupts.

Further explanation: during the development of an application using CAN
communication, a interrupt-run-away was found in some situations.  It was
found that the error interrupt triggered (Warning, Passive or Bus-Off, all
triggered it) the run-away.  The only recovery was a reset.

Two problems were found:
- the error interrupt is enabled but not cleared in the interrupt routine;
- an internal variable 'State' that was used to track the message received
  state (empty, new, full, overflow) that was not directly related to
  interrupt that indicated the state.

In this commit these issues are fixed by adding more values for the
interrupt reason (warning, passive, bus off) and clearing the error
interrupts, and making the internal state directly dependent on the
interrupt state for received messages.

Furthermore, introducing the FIFO1 in the CAN receive stage, another issue
existed.  Even if the messages are received into the FIFO1 (by selecting
message filtering for FIFO0 and FIFO1), the interrupt firing was indicating
FIFO0 Rx.  The configuration of the interrupts for this is now also fixed.
The CAN peripheral has 2 interrupt lines going into the NVIC controller.
The assignment of the interrupt reasons to these 2 interrupt lines was
missing.  Now the reception of FIFO1 messages triggers the second interrupt
line.  Other interrupts (Rx FIFO0 and bus error) are assigned to the first
interrupt line.

Tested on a Nucleo-G474, and also checked the HAL function to work with the
H7 family.
2022-01-27 23:01:08 +11:00
..
bare-arm bare-arm/mpconfigport.h: Disable remaining optional features. 2021-11-01 14:23:06 +11:00
cc3200 py/runtime: Allow initialising sys.path/argv with defaults. 2021-12-18 00:08:07 +11:00
esp32 esp32/partitions: Increase size of app-part from 0x180000 to 0x1F0000. 2022-01-27 16:44:13 +11:00
esp8266 esp8266: Allow building a board to any dest directory. 2021-12-30 15:47:49 +11:00
javascript py/runtime: Allow initialising sys.path/argv with defaults. 2021-12-18 00:08:07 +11:00
mimxrt mimxrt: Simplify Makefile in selection of flash type. 2022-01-27 17:05:45 +11:00
minimal minimal/mpconfigport.h: Disable features that are not needed. 2021-11-05 13:12:18 +11:00
nrf ports: Update board.json files to link to new board images. 2022-01-07 11:33:28 +11:00
pic16bit all: Update to point to files in new shared/ directory. 2021-07-12 17:08:10 +10:00
powerpc all: Update to point to files in new shared/ directory. 2021-07-12 17:08:10 +10:00
qemu-arm all: Update to point to files in new shared/ directory. 2021-07-12 17:08:10 +10:00
rp2 rp2/machine_i2c: Use soft I2C only for len=0, and increase timeout. 2022-01-21 15:10:29 +11:00
samd py/runtime: Allow initialising sys.path/argv with defaults. 2021-12-18 00:08:07 +11:00
stm32 stm32/fdcan: Fix FIFO1 usage and handling of error interrupts. 2022-01-27 23:01:08 +11:00
teensy py/runtime: Allow initialising sys.path/argv with defaults. 2021-12-18 00:08:07 +11:00
unix py/modmath: Add math.tau, math.nan and math.inf constants. 2022-01-23 09:28:33 +11:00
windows windows: Add micropython.schedule support. 2022-01-23 10:55:08 +11:00
zephyr zephyr/modbluetooth_zephyr: Provide dummy connect_cancel function. 2022-01-13 13:45:55 +11:00