# Project Name: Lin_Demo

---
## Function description

This example two Lin Channels (LINFlexD0, LINFlexD1).
LINFlexD0 is used as master node, continuously send frames to the Lin bus.
LINFlexD1 is used as the slave node to receive data.
Calling Lin_SendFrame sends frames of type LIN_MASTER_RESPONSE with ids from 0x1F to 0x28; and frames of type LIN_SLAVE_RESPONSE with ids from 0x29 to 0x32, where frames with IDs 0x2E, 0x30, 0x32 slave nodes do not respond.
LINFlexD1, as a slave, prohibits the passage of the following IDs:0x01,0x22,0x30,0x12,0x26,0x2e.

| channel | channel name | HwChannel | EVB pin |
| ------- | ---------    | --------- | ------- |
|  LIN1   |    Door      | LINFlexD0 |   J10   |
|  LIN2   |   Window     | LINFlexD1 |   J15   |

---
## Note
Due to the hardware characteristics of LIN, the selected system power supply is a 12V-5V DC-DC converter. Therefore, the jumper cap J3 must be connected to pins 1-2 (connecting pins 2-3 powers the system via USB 5V).

---

## Setup

+ ***Step1***: Open the Lin_Demo.yct with the YCT tool, config the toolchain per your required(by default, the VS code + GCC are used)
+ ***Step2***：Generate the codes， you can change the configurations if needed(to adapt to your own HW design), if so, please ensure all the modifications are OK with no any errors exist before generating the code.
+ ***Step3***: Open the generated project with VS code/IAR/Keil IDE per your selected.
+ ***Step4***: Compile the project, power on the EVB and download it to the EVB via the available debugger, such as a J-Link debugger probe.
+ ***Step5***: If you have not changed the default config, the bus interface is located at J10(Channel0, LINFlexD0, Lin baudarte is 19200bps) and J15 (Channel1, LINFlexD1, Lin baudrate is 19200bps) of the EVB board.
+ ***Step6***: At last, enjoy the demo example.

---                                                                  

## Hardware requirement
+ **EVB**: YTM32B1MD1-EVB-Q100-Rev.A/B
+ **Debugger**: J-Link HW v9 or later with YUNTU `YTM32B1MD1` patch(support package) installed.

**Note**: Please check the version number at the bottom of the EVB. If it is `YTM32B1MD1-EVB-Q100-Rev.A/B`, please use the example projects ending with `_RevA` for `Icu_Demo`.
---

## Software requirement

+ **Config & Code Generation Tool**
  + **MCAL**: Yuntu Config Tool(YCT) v2.7.0 or later version
+ **Compiler Toolchain**
  + **GCC**: GNU GCC v10.3 or later version
  + **Keil/MDK**: ARM Keil/MDK v5.36 or later version(`armclang v6.18.2` is recommended to be used as the compiler)
  + **IAR**: IAR v9.50 or later version
  + **VS Code**: Microsoft Visual Studio Code IDE v1.76 or later version(C/C++ support, GNU toolchain, CMake v3.25, ninja, Cortex-Debug extensions installation required)
+ **Debugger driver**
    + **J-Link**: SEGGER J-Link v7.82 or later version, YUNTU `YTM32B1MD1` patch(support package) installation required.
    + **Ozone Debugger tool**: SEGGER Ozone v3.28 or later version.

    ***Note***: **YTM32B1MD1** patch install required which can be obtained via **YCT** or contact ***YUNTU sales/FAE team***.

---