Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

nRF52 SDK 2.2.0 Edit Zigbee Light Bulb example to use external I2C RGB LED Driver

Hi,

I'm pretty lost in the nRF52 SDK V2.2.0. I've managed to get my nRF52840 DK to connect to my existing Zigbee network using the Zigbee Light Bulb example.

Now I'm trying to make the example code use an external I2C RGB LED driver ( SM2135E ) instead of its onboard LEDs but I can't find what functions need to be modified to achieve this.

Or is there an easier way? I saw some posts about overlays, but didn't get very far.

Can somebody please point me in the right direction?

Kind regards,

Dan

Parents
  • Hello,

    Thank you for contacting DevZone at NordicSemi.

    As you want to you your own LED driver, and that connected to I2C bus, you can write an overlay to define your pin connections and then use zephyr constructs in your main code to get the device.

    Typically, the hardware is described in header files in embedded firmware development. However, nRF Connect SDK uses a more structured and modular method to describe hardware that is based on Zephyr RTOS. It is done through the devicetree (DTS).

    Devicetree is a data structure that describes the hardware (mcu, board, system, sensors etc.). The devicetree uses a specific format consisting of nodes connected together, where each node contains a set of properties. When we use nRF SDK for nordic boards, the devicetree is provided (built-in) and you can see the compiled devicetree for your board in the VSCode Environment.

    You can read more about devicetree here on devacademy.  https://academy.nordicsemi.com/topic/devicetree/

    Using devicetree overlays, we can update, modify and change the hardware. In the overlay, you only need to describe the node which you want to add.

    You can create an overlay like this by including your device/node.

    Then you can use Zephyr Devicetree API to get the device and use it in your code. You will probably be using functions defined in i2c.h.

    You may also see Zephyr RTOS API Pinctrl.

    Regards,

    Naeem

Reply
  • Hello,

    Thank you for contacting DevZone at NordicSemi.

    As you want to you your own LED driver, and that connected to I2C bus, you can write an overlay to define your pin connections and then use zephyr constructs in your main code to get the device.

    Typically, the hardware is described in header files in embedded firmware development. However, nRF Connect SDK uses a more structured and modular method to describe hardware that is based on Zephyr RTOS. It is done through the devicetree (DTS).

    Devicetree is a data structure that describes the hardware (mcu, board, system, sensors etc.). The devicetree uses a specific format consisting of nodes connected together, where each node contains a set of properties. When we use nRF SDK for nordic boards, the devicetree is provided (built-in) and you can see the compiled devicetree for your board in the VSCode Environment.

    You can read more about devicetree here on devacademy.  https://academy.nordicsemi.com/topic/devicetree/

    Using devicetree overlays, we can update, modify and change the hardware. In the overlay, you only need to describe the node which you want to add.

    You can create an overlay like this by including your device/node.

    Then you can use Zephyr Devicetree API to get the device and use it in your code. You will probably be using functions defined in i2c.h.

    You may also see Zephyr RTOS API Pinctrl.

    Regards,

    Naeem

Children
Related