aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/can.c
Commit message (Collapse)AuthorAgeFilesLines
* stm32: Remove stm32f4 canbus warningKevin O'Connor2022-07-291-1/+0
| | | | | | The canbus code has been successfully tested on stm32f4. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canserial: Rename canbus.c to canserial.cKevin O'Connor2022-06-271-0/+1
| | | | | | | | | | Rename the canbus.c code to canserial.c and introduce new wrapper functions in canbus.c that connect the low-level canbus hardware code to the high-level canserial.c code. This is in preparation for adding "usb to canbus bridge mode". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Add support for disabling the canbus filterKevin O'Connor2022-06-271-7/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Move canbus uuid calculation to canbus.cKevin O'Connor2022-06-161-5/+0
| | | | | | | | Move the uuid hash calculation to canbus.c and call canbus_set_uuid() from src/stm32/chipid.c . This simplifies the low-level canbus hardware code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Support passing through RTR and EFF canbus framesKevin O'Connor2022-06-161-2/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Use single method for reading canbus messagesKevin O'Connor2022-06-161-66/+16
| | | | | | | | | | | | Previously the code had canbus_read() which was called from task context (for admin messages), and canbus_process_data() which was called from irq context (used for data messages). Change that to a single canbus_process_data() function that is called from irq context (used for all messages). This simplifies the low-level hardware specific canbus code and should make it easier to support other hardware implementations. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: use TME bits to find the canbus tx mailboxEric Callahan2022-06-031-1/+5
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* stm32: stm32g0b1 fdcan support (#5488)BIGTREETECH2022-06-011-1/+1
| | | Signed-off-by: Alan.Ma from BigTreeTech <tech@biqu3d.com>
* stm32: Remove unused header from can.cKevin O'Connor2022-05-101-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: CAN Kconfig typoOliver2021-04-071-1/+1
| | | | | | Fixed simple typo in the Kconfig and can.c. stm32f4 CAN Pins Signed-off-by: Oliver Walter <oli1111@web.de>
* stm32: Minor optimization to can.c IRQ data readingKevin O'Connor2021-03-181-10/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Support reading CAN packets directly from IRQ handlerKevin O'Connor2021-03-181-3/+24
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Simplify USB/Serial/CANbus Kconfig selectionKevin O'Connor2021-03-181-9/+9
| | | | | | | Combine the various communication options into a single "make menuconfig" menu item. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Rework CAN command protocolKevin O'Connor2021-03-131-18/+10
| | | | | | | Rework the micro-controller command protocol so that it supports direct communication with the serialqueue.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Add STM32F429 variant (#3926)Arek2021-02-181-3/+8
| | | | | | | * Add F429 variant; add CAN on PD0,PD1; add 25Mhx clock; move CAN1_RX from PI8 to correct position (PI9) * Add test for STM32F429 Signed-off-by: Arkadiusz Raj <arek.raj@gmail.com>
* canbus: Call can_notify_rx() at startup so low-level code does not need toKevin O'Connor2021-02-091-3/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Rename canbus_set_dataport() to canbus_set_filter() and simplifyKevin O'Connor2021-02-091-11/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* canbus: Move high-level CAN code to new src/generic/canbus.cKevin O'Connor2021-02-021-175/+70
| | | | | | | | | | Separate out the high-level command processing logic from the low-level transmission code. Place the high-level code in src/generic/canbus.c . This also removes the CAN dependency on serial_irq.c . Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Simplify can.c irq handlerKevin O'Connor2021-02-021-127/+130
| | | | | | | Don't perform any heavy tasks in the CAN interrupt handler - just notify a background task to handle anything pending. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Use CAN_TSR_CODE to select next tx fifo in can.cKevin O'Connor2021-02-021-6/+2
| | | | | | | | | | The spec states that the TX fifo is transmitted in chronological order if the TXFP bit is set, but it's unclear if the software needs to fill the tx fifo in a particular order to obtain that result. Use the TSR CODE bit field to fill the TX fifo in the order that the hardware reports as next. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Avoid read+write modify instructions in can.cKevin O'Connor2021-02-021-24/+13
| | | | | | | | | Prefer explicitly setting the hardware registers and avoid using C read and modify instructions where possible. This avoids race conditions where an interrupt or hardware change could cause subtle corruption of the register state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Introduce new can_set_filter() helper function in can.cKevin O'Connor2021-02-021-40/+32
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Update can.c to use more consistent indentationKevin O'Connor2021-02-021-146/+143
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32: Fixed CAN bus for STM32F4, there were syntax errors that prevented ↵bondus2020-10-111-3/+3
| | | | | | compilation Signed-off-by: Pontus Borg <liquidpontus@yahoo.se>
* stm32: Improvements to CAN bus ID generation. And added a small fast hash ↵bondus2020-08-091-4/+3
| | | | | | | | library (#3165) Improved CAM bus ID generation, there were issues with ID collisions. Added a small fast hash library. Signed-off-by: Pontus Borg <liquidpontus@yahoo.se>
* stm32: Improved CAN support for STM32 (#2976)bondus2020-06-241-0/+440
Reworked the STM32F0 CAN bus implementation. It's more robust and higher performance. Added support for function remapping to different pins. API is emulating an STM32F0. Improved and ported CAN bus to STM32F0, F1 and F4. Signed-off-by: Pontus Borg <glpontus@gmail.com>