NCV7430 LED Controller over LIN

Browse source code on GitHub

Overview

This sample demonstrates how to use the Local Interconnect Network (LIN) API to control an RGB LED using NCV7430 LED Controller. You could find more details about NCV7430 in the NCV7430 Datasheet.

The LIN controller acts as a LIN commander node that sends commands to the NCV7430 LED controller to change the LED colors. The application cycles through a set of predefined colors, sending the appropriate LIN messages to the NCV7430 to update the LED color accordingly.

Requirements

  • A board with LIN controller support (e.g., ek_ra8m1/r7fa8m1ahecbd).

  • An NCV7430 evaluation board connected to the LIN controller pins (e.g. skpang NCV7430 Breakout Board).

Building and Running

Building and Running for EK-RA8M1

The RA8M1 Evaluation Kit board does not come with an onboard LIN transceiver. In order to use the LIN bus on the EK-RA8M1 board, an external LIN bus transceiver MikroElektronika LIN Click must be connected to this board:

  • P609 EK-RA8M1 (TXD) <-> RXD mikroe LIN Click

  • P610 EK-RA8M1 (RXD) <-> TXD mikroe LIN Click

  • GND EK-RA8M1 <——–> GND mikroe LIN Click

  • 3.3V EK-RA8M1 <——-> 3V3 mikroe LIN Click

  • P601 EK-RA8M1 <——–> EN mikroe LIN Click

  • P602 EK-RA8M1 <——–> WK mikroe LIN Click

Note

An additional pull-up resistor (10k Ohm) is required between EK-RA8M1 P609 (TXD) and 3.3V to ensure proper idle state on the LIN bus.

The sample can be built and executed for the EK-RA8M1 as follows:

west build -b ek_ra8m1 --shield mikroe_lin_click samples/drivers/lin/ncv7430
west flash

Observe the LED color changes on the NCV7430 evaluation board as the application cycles through the predefined colors.

Sample Output

NCV7430 sample started
Set LED color: Red - read back actual color code: 0xFF0000
Set LED color: Green - read back actual color code: 0x00FF00
Set LED color: Blue - read back actual color code: 0x0000FF

See also

LIN Controller