High-end cars, such as Mercedes-Benz, have powerful atmosphere lights. They use a single chip to aggregate MCU (supposed to be 51 core), LED controller, LIN transceiver, power management and other hardware. The overall size is only the size of a fingernail. It should be said that The degree of integration is very high. On the back is a PWM adjustable three-color LED with three primary colors (blue-green-red). The overall can send colorful ambient light through LIN bus data control.
This kind of atmosphere lamp has a small appearance and simple structure. It adopts a three-wire system (actually 4 wires: VBAT, GND, LIN in, LIN out-because multiple LIN nodes are connected in parallel), and it is currently the most popular car single product.
However, it is not easy to capture these LIN data because of the special nature of the LIN bus protocol: single-line LIN is a master-slave mode; all clocks are controlled by the LIN master node; there is no arbitration mechanism on the LIN bus.
Therefore, it is actually very difficult to control the ambient light on this basis, which is manifested by these several difficulties:
1. Unable to obtain LIN control data;
2. Unable to analyze LDF files and obtain time slots;
3. Can't bypass the LIN master to send data.
--------------------------------- Gorgeous dividing line -------------- ---------------------------------------------
For Difficulty 1, there are some tools that can display data, but the price is up, for example, KVASER LIN hardware starts at 3K and software starts at 2W. It basically exceeds the development cost of a general project. But the cost is only one aspect, as long as you have the most expensive tools you have to buy. (Later, I found a cheaper LIN tool in a certain treasure, actually LIN-UART)
However, these tools only display data. How to analyze and screen the acquired LIN data depends on your own experience.
Even with a LIN tool, you still have to face the latter two difficulties: analyzing data and sending data.
Because the LIN bus does not have an arbitration mechanism, and there is already a LIN master node, the slaves cannot send data out; the time slot must be analyzed by the LDF file; the LDF file is difficult to obtain by analyzing the data. . . Basically no solution.
Since the LDF file cannot be obtained, temporarily send some data at random for the time being. Unfortunately, no data can be sent at will regardless of any LIN tool (this is limited by the LIN communication protocol, because there is no arbitration mechanism). If you want to send data at will, you can only use a microcontroller to build a LIN node and send data during the LIN bus idle time period.
-------------------------------------------------- -------------------------------------------------- -
Although there are many difficulties, there are definitely more ways to solve the problem. At first, the STM32F10x + TJA1020 method was used, but LIN Break always sent data errors. After debugging for a long time, there was no result. The LBD interrupt could not be entered either. Later, it was found that the UART4 used could only be used as an ordinary serial port, not LIN. . . Bai busy living a long time. Later, after much inquiry, I finally found a professional-looking LIN development board in an unknown corner of Bao. The STM32F042 + TJA1020 solution used, two verification algorithms are provided in the DEMO source code, which is quite kind. The latter rely on their own data analysis.
-------------------------------------------------- -------------------------------------------------- -----------------
20180129, the project has been resolved, because it is a customer project inconvenient to disclose specific content. It is probably that the timing requirements are relatively strict. The initialization process must conform to a certain PID SID configuration protocol, and others are omitted.
Blue-green color mixing: (green is more blue and less green)
Red, green and blue color mixing, approximate white light: (Buy online with LIN-UART tool)
LIN serial tool: This tool was purchased by a certain treasure. You can use the serial debugging assistant to see LIN data, which is a relatively cheap LIN tool.
This atmosphere light can control the intensity of various colors through the LIN bus data, and it can also show the effect similar to breathing lights. It seems that if you explore carefully, you can also realize a lot of different gameplay through the LIN bus.
Of course, there are many color mixing methods, which can basically simulate all the colors in the palette. However, the color mixing result is not perfect. Only the center position has a better color mixing effect, because the positions of the three-color LED light sources are staggered to cause the light emission ranges to not completely overlap, and the side light leakage can still identify the red, green, and blue colors.