> For the complete documentation index, see [llms.txt](https://inacks.gitbook.io/inacks-is3720-i2c-dmx+rdm-receiver-ic/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://inacks.gitbook.io/inacks-is3720-i2c-dmx+rdm-receiver-ic/examples/stm32-firmware.md).

# STM32 Firmware

> *The following chapter provides example firmware for demonstration purposes only and does not form part of the product specification. The customer is responsible for implementing their own solution and for ensuring compliance with applicable legislation and the DMX and RDM specifications.*

## Kappa3720Ard: IS3720 Evaluation Board for Arduino and STM32 Nucleo Boards

Visit our product page to place your order: [Kappa3720Ard](https://www.inacks.com/is3750)

<div><figure><img src="https://4031855160-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMR1I6AmpcBW5WamvgJ4O%2Fuploads%2FflSKwT8TpmggqMlPapGS%2FINACKS%20Kappa3720Ard%20RDM%20Responder.jpg?alt=media&amp;token=a2345e1a-097c-4e8c-aadc-c160f5bf7385" alt=""><figcaption></figcaption></figure> <figure><img src="https://4031855160-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMR1I6AmpcBW5WamvgJ4O%2Fuploads%2FPD5UT1SKwTpYtY6h3uRx%2FINACKS%20Kappa3720Ard%20RDM%20Responder%20Top.jpg?alt=media&amp;token=625d6719-a7c9-4298-8bd4-e6ddb4715fa2" alt=""><figcaption></figcaption></figure></div>

Coding the IS3720 on an STM32 is very simple. You do not need any special libraries—using the I2C HAL functions HAL\_I2C\_Mem\_Read() and HAL\_I2C\_Mem\_Write() is sufficient to communicate with the IS3720.

In the example, the first operation is to enable RDM communication by writing a 1 to the RDM\_ONLINE register (address 631). Once this is done, you only need to continuously check the DMX\_START\_ADDRESS register (address 516 and 517) to ensure you always read the correct DMX channels assigned to your device. This is important because the lighting operator may change your DMX Start Address via RDM, which is one of the most commonly used RDM features.

Once you have read your DMX data, you can send it to your LEDs using PWM or whatever control method your product implements. The pwm() functions in the example code are provided for reference only.

Before enabling RDM, typical operations include setting the product information, such as the manufacturer label, software version, device category, etc.

In the while(1) loop, it is also necessary to regularly check the IDENTIFY\_DEVICE register to determine whether the lighting operator has requested the device to identify itself.

```c
// Enable RDM operation
uint8_t startRDM[1];	  
startRDM[0] = 1;
HAL_I2C_Mem_Write(&hi2c1, (22 << 1), 631, I2C_MEMADD_SIZE_16BIT, startRDM, 1, 1000);

while (1) {
	uint8_t readDmxStartAddress[2];
	uint16_t dmxStartAddress;
	uint8_t readDmxChannels[3];
	
	// Read the DMX start address assigned via RDM
	HAL_I2C_Mem_Read(&hi2c1, (22 << 1), 516, I2C_MEMADD_SIZE_16BIT, readDmxStartAddress, 2, 1000);
	dmxStartAddress = readDmxStartAddress[0] << 8;
	dmxStartAddress = dmxStartAddress | readDmxStartAddress[1];
	
	// Read DMX channel data starting at the start address
	HAL_I2C_Mem_Read(&hi2c1, (22 << 1), dmxStartAddress, I2C_MEMADD_SIZE_16BIT, readDmxChannels, 3, 1000);
	
	// Update PWM outputs
	pwm(channelRed, readDmxChannels[0]);
	pwm(channelGreen, readDmxChannels[1]);
	pwm(channelBlue, readDmxChannels[2]);
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://inacks.gitbook.io/inacks-is3720-i2c-dmx+rdm-receiver-ic/examples/stm32-firmware.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
