stm32--Universal Lin Controller
Purpose: The sharing of technology is limited, the spirit of sharing is unlimited.
Demand:
Lin Motor controller: AFS (DHL+AFL)--Corner assist lighting system
DHL: Upper limit, under limit, 0-bit, motor aging cycle;
AFL: Left limit, right limit, 0-bit, motor aging cycle;
All parameters can be configured: upper limit, lower limit, 0-bit, left limit, right limit, motor cycle limit, motor cycle limit, motor cycle times, motor cycle wait time;
Save at least 30 product configuration, configuration interface needs to have add, read, find, delete function.
Solution: STM32 + Lin + serial (using NXP's serial screen, Tja series Lin Chip)
STM32 Lin interface as the primary node, the motor as the slave node.
System design: RTX multi-task design, serial processing tasks, display processing tasks, Lin send tasks;
(1), Serial Processing task: Click on the serial screen will get to click on the coordinate values, serial interrupt to accept the data into the queue, the task of the team to resolve the coordinates, to determine whether the upper and lower limits, etc.
(2), Lin Send task: 20ms cycle frame, timer set event, task waiting for event, and send Lin period frame; (periodic frames are specific product protocols)
(3), display tasks:
Configuration Interface--add configuration, input all parameters and save to MCU internal flash, read configuration, read parameters from Flash to specify location of interface, find configuration, display the matching parameters from Flash to interface by device model, delete configuration.
Logic function-Initialize, configure the motor 0-bit, upper and lower limits, modify Lin periodic frame parameters, up/down Left/right/limit, 0 position, motor go to the specified position; Motor cycle, motor aging experiment, keep up and down, cycle frame, time configurable, the number can be configured.