eeeck
24e100cae6
Use better name for CAN listener task function
2026-06-16 22:34:55 +02:00
eeeck
7d5b3f9be2
Increase all queue sizes and double the UART queue
2026-06-16 22:29:00 +02:00
eeeck
c540ff7800
Remove dead code
2026-06-16 22:13:52 +02:00
eeeck
dfc116b2e9
Fix linker error by moving RTOS thread declaration to global scope
2026-06-16 22:12:40 +02:00
eeeck
59b0aca092
Refactor: implement data relay from vCANLoggerListen to xUARTQueue
...
- No RTOS event, just queue put and get: cleaner way to send data and
more clear separation of concerns
2026-06-16 22:09:49 +02:00
eeeck
5f11cf5213
Revert decision on moving CAN event flag outside ISR
...
- Would have caused destruction of the queue data itself
2026-06-16 21:34:43 +02:00
eeeck
74bf4bde77
Implement identical queue drain for CAN2 to that of CAN1
2026-06-16 21:29:32 +02:00
eeeck
3691918196
Non-blocking on CAN1 queue check
...
- Check queue instantly
- Use DMA to move tx_buffer to UART peripheral
- Use a semaphore to DMA is being done, to avoid moving to next loop
iteration and overwriting tx_buffer
- HAL_UART_TxCpltCallback will release semaphore when DMA done
2026-06-16 21:27:52 +02:00
eeeck
79f317cec5
Wait until CAN1 or CAN2 save anything to FIFO buffer
...
- Moving CAN event flag to vCANLoggerListen to avoid possible race
condition and to make ISR leaner
2026-06-16 21:06:32 +02:00
eeeck
da1c13fcb0
Fix comment blocks and function descriptions
2026-06-16 21:02:15 +02:00
eeeck
59274272d3
Remove not useful comment blocks
...
- Not really used by CubeMX so worth removing
2026-06-16 20:25:21 +02:00
eeeck
bc71cd7371
Add comment headers
2026-06-16 20:06:21 +02:00
eeeck
84980d2378
Implement hex converter
...
- Avoids snprintf
- Can be read from minicom/screen, but it's also friendly for other MCU
- This single function was AI generated
2026-06-16 19:55:44 +02:00
eeeck
8b1b3b7ff3
Implement safe UART semaphore release inside ISR
...
- It uses safe way to release semaphore
- Yields in case task interrupted was of lower priority: UART has
minimal latency
2026-06-16 19:49:13 +02:00
eeeck
0d0e485193
Initialize cansend headers
2026-06-16 19:34:12 +02:00
eeeck
ac5d9f6a72
Set CAN event flag and LED thread flag in ISR
...
- This is efficient specifically for
STM32F4x with Thumb-2 IT block
optimization enabled (-02 or -03)
2026-06-16 19:11:38 +02:00
eeeck
76628dec90
Initialize UART task and semaphore and CAN event flags
2026-06-16 19:10:53 +02:00
eeeck
f260dfe972
Use define instead of hardcoded value
2026-06-16 18:11:12 +02:00
eeeck
12ef44d3d8
Use clearer variable name
2026-06-16 18:06:26 +02:00
eeeck
af4ce2f9e8
Remove unecessary MXCube comments
2026-06-16 18:01:54 +02:00
eeeck
34df5e51b7
Remove LED contexts
...
- Are now unnecessary with the move to task notification
2026-06-16 17:59:57 +02:00
eeeck
266efdfa7c
Fix spacing
2026-06-16 17:57:42 +02:00
eeeck
7d40531250
Return instead of critical error
...
- To find a way to handle overflows on the FIFO buffer
2026-06-16 17:57:35 +02:00
eeeck
6446f5209b
Remove semaphores in favor of task notifications
...
- Less overhead, simpler to manage
- Semaphores are apparently overkill for a simple blink timer
2026-06-16 17:56:11 +02:00
eeeck
cc3a37ba4b
Increase UART baudrate
2026-06-16 16:16:51 +02:00
eeeck
990a85c002
Enable UART interface from MXCube
2026-06-16 16:01:49 +02:00
eeeck
2c14d095f7
Better way to avoid race condition, only notification lives in CAN task
...
- Runs only once
- Only critical notification is inside task
- CAN message during boot will not be lost, instead put inside FIFO0
2026-06-15 14:30:35 +02:00
eeeck
975acb8c3e
Indentation fixes
2026-06-15 14:27:05 +02:00
eeeck
b1744ce941
Fix double semaphore release
2026-06-15 14:17:12 +02:00
eeeck
c1d2e65e20
Move to RTOS_THREADS
...
- ops...
2026-06-15 14:12:47 +02:00
eeeck
ce85e473b3
Move before starting scheduler to avoid race condition
...
- If a CAN message arrives during boot time ISR will fire and try to put
data into xCAN1RxQueue. At that time queue is NULL: calling RTOS APIs
on NULL handles will cause a HardFault
2026-06-15 14:11:11 +02:00
eeeck
8c8fe93d5b
Release CANrx semaphore in ISR
2026-06-15 14:09:51 +02:00
eeeck
ab8b68313b
Transition from timer based to task based LED signal
...
- Remove RTOS timers
- Create LED task
- Avoid polling, instead wait for semaphore
2026-06-15 14:06:51 +02:00
eeeck
70cead28d7
Re-add newlib lock glue to Src
2026-06-15 10:37:01 +02:00
eeeck
ac212c4a0a
Merge pull request 'Change headers with better copyright comments' ( #13 )
...
from code-licensing into j1939
Reviewed-on: erickahmed/j1939_logger#13
2026-06-14 21:36:45 +02:00
eeeck
9fc2f0b73b
Remove files that were misteriously duplicated...
2026-06-14 21:33:13 +02:00
eeeck
3c66a39a5d
Fix variable name mismatch
2026-06-14 21:27:10 +02:00
eeeck
19eefc288b
Fix scope error by moving declaration
2026-06-14 20:48:11 +02:00
eeeck
17febf569a
Use a more generic name as semaphore will be used by other tasks
2026-06-14 18:31:54 +02:00
eeeck
53772ccb7d
Remove error handling as it would cause crash on full queue
2026-06-14 16:45:02 +02:00
eeeck
9d4d807cfb
Fix race condition that could cause a hard fault
2026-06-14 16:21:55 +02:00
eeeck
5ec806ffea
Add CMSIS include
2026-06-14 16:17:01 +02:00
eeeck
8777f742ac
Move typedef to header
2026-06-14 16:15:33 +02:00
eeeck
4aafa81009
Change CODE BEGIN N value
2026-06-14 16:14:20 +02:00
eeeck
ac16f8150e
Use a more sensible number of semaphores
2026-06-14 16:10:18 +02:00
eeeck
f0d2990b8d
Move below timer setup
2026-06-14 16:10:00 +02:00
eeeck
72ffb2644e
Use more clear variable names
2026-06-14 16:09:45 +02:00
eeeck
75efc4840d
Use new context structure instead of direct pass
2026-06-14 15:17:03 +02:00
eeeck
a75d42faeb
Create context structure for timer callback
...
Strucure is made of
- LED (port, pin)
- Semaphore
- Timer handle
2026-06-14 15:16:23 +02:00
eeeck
5b500d72ff
Avoid having to declare additional variable
2026-06-14 14:56:32 +02:00