Skip to content

Commit 29d2048

Browse files
committed
added LIN firmware support
1 parent 6e041aa commit 29d2048

File tree

15 files changed

+392
-18
lines changed

15 files changed

+392
-18
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Microcontroller peripherals are made available over each interface via a custom
1313

1414
- Metadata
1515
- CAN FD
16+
- LIN
1617
- SPI controller
1718
- I2C controller
1819
- UART

firmware/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ config JABI_CAN_BUFFER_SIZE
1212
help
1313
must be >0
1414

15+
config JABI_LIN_BUFFER_SIZE
16+
int "LIN buffer size"
17+
default 64
18+
help
19+
must be >0
20+
1521
config JABI_REQ_PAYLOAD_MAX_SIZE
1622
int "interface request payload maximum size"
1723
default 128

firmware/boards/jabican_usb_pro.conf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ CONFIG_USB_DEVICE_PRODUCT="JABICAN-USB Pro"
1919
CONFIG_USB_SELF_POWERED=n
2020
CONFIG_USB_MAX_POWER=250
2121

22-
CONFIG_UART_INTERRUPT_DRIVEN=y
23-
2422
# Peripheral settings
2523
CONFIG_CAN=y
2624
CONFIG_CAN_AUTO_BUS_OFF_RECOVERY=y
25+
CONFIG_LIN=y
2726
CONFIG_GPIO=y
28-
29-
CONFIG_JABI_UART_RX_BUFFER_SIZE=4096

firmware/boards/jabican_usb_pro.overlay

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77

88
peripherals {
99
compatible = "jabi,peripherals";
10-
uart = <&uart2>; // TODO replace with LIN once driver written
1110
can = <&flexcan0>;
12-
gpio = <&led_red &led_green &led_blue &lin_cmdr_en &lin_pwr_en &can_pwr_en>;
11+
lin = <&lin0>;
12+
gpio = <&led_red &led_green &led_blue &btn0 &btn1 &btn2
13+
&lin_cmdr_en &lin_pwr_en &can_pwr_en>;
1314
};
1415
};
1516

firmware/boards/k66f_breakout.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ CONFIG_DEBUG_THREAD_INFO=y
33
CONFIG_JABI_SERIAL="k66f breakout 69420"
44

55
CONFIG_LOG=n
6-
CONFIG_LOG_DEFAULT_LEVEL=2
7-
CONFIG_LOG_MODE_IMMEDIATE=y
86

97
# Interface settings
108
CONFIG_JABI_REQ_PAYLOAD_MAX_SIZE=8192
@@ -19,7 +17,6 @@ CONFIG_USB_DEVICE_PRODUCT="K66F Breakout"
1917
CONFIG_USB_SELF_POWERED=n
2018
CONFIG_USB_MAX_POWER=250
2119

22-
CONFIG_USB_CDC_ACM_LOG_LEVEL_ERR=y
2320
CONFIG_UART_INTERRUPT_DRIVEN=y
2421

2522
# Peripheral settings

firmware/boards/leveler.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
CONFIG_JABI_SERIAL="leveler 69420"
22

33
CONFIG_LOG=n
4-
CONFIG_LOG_DEFAULT_LEVEL=2
5-
CONFIG_LOG_MODE_IMMEDIATE=y
64

75
# Interface settings
86
CONFIG_JABI_REQ_PAYLOAD_MAX_SIZE=16384
97
CONFIG_JABI_RESP_PAYLOAD_MAX_SIZE=16384
108
CONFIG_JABI_THREAD_STACK_SIZE=65536
119

1210
CONFIG_USB_DEVICE_STACK=y
13-
CONFIG_USB_CDC_ACM_LOG_LEVEL_ERR=y
1411
CONFIG_UART_INTERRUPT_DRIVEN=y
1512

1613
# Peripheral settings

firmware/boards/nogusb.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ CONFIG_CONSOLE=n
88
CONFIG_UART_CONSOLE=n
99

1010
CONFIG_LOG=n
11-
CONFIG_LOG_DEFAULT_LEVEL=2
12-
CONFIG_LOG_MODE_IMMEDIATE=y
1311

1412
# Interface settings
1513
CONFIG_JABI_REQ_PAYLOAD_MAX_SIZE=4096
@@ -24,7 +22,6 @@ CONFIG_USB_DEVICE_PRODUCT="NOGUSB"
2422
CONFIG_USB_SELF_POWERED=n
2523
CONFIG_USB_MAX_POWER=250
2624

27-
CONFIG_USB_CDC_ACM_LOG_LEVEL_ERR=y
2825
CONFIG_UART_INTERRUPT_DRIVEN=y
2926

3027
# Peripheral settings

firmware/dts/bindings/jabi,peripherals.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ properties:
2222

2323
uart:
2424
type: phandles
25+
26+
lin:
27+
type: phandles

firmware/src/peripherals/can.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ PERIPH_FUNC_DEF(can_set_filter) {
102102
}
103103
can->ext_id = can_add_rx_filter_msgq(can->dev, can->msgq, &can->filter_ext);
104104
if (can->std_id == -ENOSPC || can->ext_id == -ENOSPC) {
105-
LOG_ERR("failed to change filters for can%d", idx);
105+
LOG_ERR("failed to change filters for can%d, old filter also removed", idx);
106106
return JABI_PERIPHERAL_ERR;
107107
}
108108

firmware/src/peripherals/common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ extern const struct periph_api_t adc_periph_api;
99
extern const struct periph_api_t dac_periph_api;
1010
extern const struct periph_api_t spi_periph_api;
1111
extern const struct periph_api_t uart_periph_api;
12+
extern const struct periph_api_t lin_periph_api;
1213

1314
const struct periph_api_t *peripherals[] = {
1415
&metadata_periph_api,
@@ -20,4 +21,5 @@ const struct periph_api_t *peripherals[] = {
2021
&dac_periph_api,
2122
&spi_periph_api,
2223
&uart_periph_api,
24+
&lin_periph_api,
2325
};

0 commit comments

Comments
 (0)