Other Parts Discussed in Thread: TXS0102
Tool/software:
Hi,
I have a design with five TPS929240 ICs, where the TX and RX pins are directly connected to USART2_RX and USART2_TX on the MCU, respectively. I use an STM32 as microcontroller. After powering up the PCB, the RX pin of the TPS929240 is at 3.3V, but the TX pin is at 0.5V. I know that TX should be 5 V when no frames are being sent, this is correct?

The LDO pin of each LED Driver outputs 5 V confirming that each IC is energized correctly.
What could be causing this issue? Could it be due to the lack of pull-up resistors on these pins, or is it related to my initialization code?
My initialization sequence is as follows:
- Power up the PCB.
- Enable PWMFREQ[3:0] = Ah (2000 Hz).
- Set ENOUTXn = 1 for all outputs.
- Send frames for PWMOUTXn and PWMLOWOUTXn registers (BRTLOCK is unlocked)
This is my CRC calculation, verifying the correct result in debugging and comparing it with the reference file from this link
uint8_t CRC_Calculation(uint8_t crc_initial, uint8_t input_data) {
uint8_t temp_bit, input_bit;
uint8_t bit[8];
uint8_t i, crc = 0;
for (i = 0; i < 8; i++) {
bit[i] = (crc_initial >> i) & 0x01;
}
for (i = 0; i < 8; i++) {
input_bit = (input_data >> i) & 0x01;
temp_bit = input_bit ^ bit[7];
bit[7] = bit[6];
bit[6] = bit[5];
bit[4] ^= temp_bit;
bit[5] = bit[4];
bit[3] ^= temp_bit;
bit[4] = bit[3];
bit[3] = bit[2];
bit[2] = bit[1];
bit[1] = bit[0];
bit[0] = temp_bit;
}
for (i = 0; i < 8; i++) {
crc |= (bit[i] << i);
}
return crc;
}
// To calculate CRC of a complete frame
uint8_t calculate_crc(uint8_t *data, uint8_t length) {
uint8_t crc = INITIAL_CRC;
for (uint8_t i = 1; i < length; i++) {
crc = CRC_Calculation(crc, data[i]);
}
return crc;
}
This is the structure of my frame (0x55 | write/read-burst-address of the LED Driver | address of the register | data | crc):
// To send an UART frame to LED driver
void send_uart_frame(uint8_t address_device, uint8_t address_register, uint8_t data) {
uint8_t frame[5];
frame[0] = 0x55; // Synchronization
frame[1] = address_device;
frame[2] = address_register;
frame[3] = data;
frame[4] = calculate_crc(frame, 4); // CRC calculation
HAL_UART_Transmit(&huart2, frame, 5, 100); // Send frame by UART
}
And this is my inicialization code:
// send_uart_frame(write/read-burst-device_address, device_register, data) // PWMFREQ[3:0] to 2000 Hz (Ah) send_uart_frame(0x81, 0x7E, 0x0A); HAL_Delay(10); send_uart_frame(0x82, 0x7E, 0x0A); send_uart_frame(0x83, 0x7E, 0x0A); send_uart_frame(0x84, 0x7E, 0x0A); send_uart_frame(0x85, 0x7E, 0x0A); // Enable all the outputs of all LED Drivers send_uart_frame(0x81, 0x40, 0x77); send_uart_frame(0x81, 0x41, 0x77); send_uart_frame(0x81, 0x42, 0x77); send_uart_frame(0x81, 0x43, 0x77); send_uart_frame(0x82, 0x40, 0x77); send_uart_frame(0x82, 0x41, 0x77); send_uart_frame(0x82, 0x42, 0x77); send_uart_frame(0x82, 0x43, 0x77); send_uart_frame(0x83, 0x40, 0x77); send_uart_frame(0x83, 0x41, 0x77); send_uart_frame(0x83, 0x42, 0x77); send_uart_frame(0x83, 0x43, 0x77); send_uart_frame(0x84, 0x40, 0x77); send_uart_frame(0x84, 0x41, 0x77); send_uart_frame(0x84, 0x42, 0x77); send_uart_frame(0x84, 0x43, 0x77); send_uart_frame(0x85, 0x40, 0x77); send_uart_frame(0x85, 0x41, 0x77); send_uart_frame(0x85, 0x42, 0x77); send_uart_frame(0x85, 0x43, 0x77);
Also I tested with enable CLRPOR and enable REGDEFAULT:
// Enable CLRPOR to 1 send_uart_frame(0x81, 0x91, 0x01); send_uart_frame(0x82, 0x91, 0x01); send_uart_frame(0x83, 0x91, 0x01); send_uart_frame(0x84, 0x91, 0x01); send_uart_frame(0x85, 0x91, 0x01); // Enable REGDEFAULT to 1 send_uart_frame(0x81, 0x94, 0x01); send_uart_frame(0x82, 0x94, 0x01); send_uart_frame(0x83, 0x94, 0x01); send_uart_frame(0x84, 0x94, 0x01); send_uart_frame(0x85, 0x94, 0x01);
My schematic design is the following file:
These are my sent frames:
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
// Get 12 bytes of RF Transceiver
if (HAL_UART_Receive(&huart1, rx_buff, 12, 1000) == HAL_OK)
{
memcpy(last_packet, rx_buff, 12);
}
else
{
// Error handle
}
state = rx_buff[8];
HAL_Delay(250);
if (state != lastState) {
// Turn on the LED indicating that the frame is sending
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET);
// Verify the byte [8] to know which button is pressed
if (state == 0x01 ) {
// On state of the LEDs
HAL_Delay(1395);
send_uart_frame(0x81, 0x20, 0x02); // 4 LSB de LED 1
send_uart_frame(0x81, 0x00, 0x1C); // 8 MSB de LED 1
send_uart_frame(0x82, 0x28, 0x02); // 4 LSB de LED 51
send_uart_frame(0x82, 0x08, 0x1C); // 8 MSB de LED 51
HAL_Delay(30);
send_uart_frame(0x81, 0x21, 0x02); // 4 LSB de LED 2
send_uart_frame(0x81, 0x01, 0x1C); // 8 MSB de LED 2
send_uart_frame(0x82, 0x29, 0x02); // 4 LSB de LED 52
send_uart_frame(0x82, 0x09, 0x1C); // 8 MSB de LED 52
HAL_Delay(30);
send_uart_frame(0x81, 0x22, 0x02); // 4 LSB de LED 3
send_uart_frame(0x81, 0x02, 0x1C); // 8 MSB de LED 3
send_uart_frame(0x82, 0x2A, 0x02); // 4 LSB de LED 53
send_uart_frame(0x82, 0x0A, 0x1C); // 8 MSB de LED 53
HAL_Delay(30);
send_uart_frame(0x81, 0x23, 0x02); // 4 LSB de LED 4
send_uart_frame(0x81, 0x03, 0x1C); // 8 MSB de LED 4
send_uart_frame(0x82, 0x2B, 0x02); // 4 LSB de LED 54
send_uart_frame(0x82, 0x0B, 0x1C); // 8 MSB de LED 54
HAL_Delay(30);
send_uart_frame(0x81, 0x24, 0x02); // 4 LSB de LED 5
send_uart_frame(0x81, 0x04, 0x1C); // 8 MSB de LED 5
send_uart_frame(0x82, 0x2C, 0x02); // 4 LSB de LED 55
send_uart_frame(0x82, 0x0C, 0x1C); // 8 MSB de LED 55
HAL_Delay(30);
send_uart_frame(0x81, 0x25, 0x02); // 4 LSB de LED 6
send_uart_frame(0x81, 0x05, 0x1C); // 8 MSB de LED 6
send_uart_frame(0x82, 0x2D, 0x02); // 4 LSB de LED 56
send_uart_frame(0x82, 0x0D, 0x1C); // 8 MSB de LED 56
HAL_Delay(30);
send_uart_frame(0x81, 0x26, 0x02); // 4 LSB de LED 7
send_uart_frame(0x81, 0x06, 0x1C); // 8 MSB de LED 7
send_uart_frame(0x82, 0x2E, 0x02); // 4 LSB de LED 57
send_uart_frame(0x82, 0x0E, 0x1C); // 8 MSB de LED 57
HAL_Delay(30);
send_uart_frame(0x81, 0x27, 0x02); // 4 LSB de LED 8
send_uart_frame(0x81, 0x07, 0x1C); // 8 MSB de LED 8
send_uart_frame(0x82, 0x2F, 0x02); // 4 LSB de LED 58
send_uart_frame(0x82, 0x0F, 0x1C); // 8 MSB de LED 58
HAL_Delay(30);
send_uart_frame(0x81, 0x28, 0x02); // 4 LSB de LED 9
send_uart_frame(0x81, 0x08, 0x1C); // 8 MSB de LED 9
send_uart_frame(0x82, 0x30, 0x02); // 4 LSB de LED 59
send_uart_frame(0x82, 0x10, 0x1C); // 8 MSB de LED 59
HAL_Delay(30);
send_uart_frame(0x81, 0x29, 0x02); // 4 LSB de LED 10
send_uart_frame(0x81, 0x09, 0x1C); // 8 MSB de LED 10
send_uart_frame(0x82, 0x31, 0x02); // 4 LSB de LED 60
send_uart_frame(0x82, 0x11, 0x1C); // 8 MSB de LED 60
HAL_Delay(30);
send_uart_frame(0x81, 0x2A, 0x02); // 4 LSB de LED 11
send_uart_frame(0x81, 0x0A, 0x1C); // 8 MSB de LED 11
send_uart_frame(0x82, 0x32, 0x02); // 4 LSB de LED 61
send_uart_frame(0x82, 0x12, 0x1C); // 8 MSB de LED 61
HAL_Delay(30);
send_uart_frame(0x81, 0x2B, 0x02); // 4 LSB de LED 12
send_uart_frame(0x81, 0x0B, 0x1C); // 8 MSB de LED 12
send_uart_frame(0x82, 0x33, 0x02); // 4 LSB de LED 62
send_uart_frame(0x82, 0x13, 0x1C); // 8 MSB de LED 62
HAL_Delay(30);
send_uart_frame(0x81, 0x2C, 0x02); // 4 LSB de LED 13
send_uart_frame(0x81, 0x0C, 0x1C); // 8 MSB de LED 13
send_uart_frame(0x82, 0x34, 0x02); // 4 LSB de LED 63
send_uart_frame(0x82, 0x14, 0x1C); // 8 MSB de LED 63
HAL_Delay(30);
send_uart_frame(0x81, 0x2D, 0x02); // 4 LSB de LED 14
send_uart_frame(0x81, 0x0D, 0x1C); // 8 MSB de LED 14
send_uart_frame(0x82, 0x35, 0x02); // 4 LSB de LED 64
send_uart_frame(0x82, 0x15, 0x1C); // 8 MSB de LED 64
HAL_Delay(30);
send_uart_frame(0x81, 0x2E, 0x02); // 4 LSB de LED 15
send_uart_frame(0x81, 0x0E, 0x1C); // 8 MSB de LED 15
send_uart_frame(0x82, 0x36, 0x02); // 4 LSB de LED 65
send_uart_frame(0x82, 0x16, 0x1C); // 8 MSB de LED 65
HAL_Delay(30);
send_uart_frame(0x81, 0x2F, 0x02); // 4 LSB de LED 16
send_uart_frame(0x81, 0x0F, 0x1C); // 8 MSB de LED 16
send_uart_frame(0x82, 0x37, 0x02); // 4 LSB de LED 66
send_uart_frame(0x82, 0x17, 0x1C); // 8 MSB de LED 66
HAL_Delay(30);
send_uart_frame(0x81, 0x30, 0x02); // 4 LSB de LED 17
send_uart_frame(0x81, 0x10, 0x1C); // 8 MSB de LED 17
send_uart_frame(0x83, 0x20, 0x02); // 4 LSB de LED 67
send_uart_frame(0x83, 0x00, 0x1C); // 8 MSB de LED 67
HAL_Delay(30);
send_uart_frame(0x81, 0x31, 0x02); // 4 LSB de LED 18
send_uart_frame(0x81, 0x11, 0x1C); // 8 MSB de LED 18
send_uart_frame(0x83, 0x21, 0x02); // 4 LSB de LED 68
send_uart_frame(0x83, 0x01, 0x1C); // 8 MSB de LED 68
HAL_Delay(30);
send_uart_frame(0x81, 0x32, 0x02); // 4 LSB de LED 19
send_uart_frame(0x81, 0x12, 0x1C); // 8 MSB de LED 19
send_uart_frame(0x83, 0x22, 0x02); // 4 LSB de LED 69
send_uart_frame(0x83, 0x02, 0x1C); // 8 MSB de LED 69
HAL_Delay(30);
send_uart_frame(0x81, 0x33, 0x02); // 4 LSB de LED 20
send_uart_frame(0x81, 0x13, 0x1C); // 8 MSB de LED 20
send_uart_frame(0x83, 0x23, 0x02); // 4 LSB de LED 70
send_uart_frame(0x83, 0x03, 0x1C); // 8 MSB de LED 70
HAL_Delay(30);
send_uart_frame(0x81, 0x34, 0x02); // 4 LSB de LED 21
send_uart_frame(0x81, 0x14, 0x1C); // 8 MSB de LED 21
send_uart_frame(0x83, 0x24, 0x02); // 4 LSB de LED 71
send_uart_frame(0x83, 0x04, 0x1C); // 8 MSB de LED 71
HAL_Delay(30);
send_uart_frame(0x81, 0x35, 0x02); // 4 LSB de LED 22
send_uart_frame(0x81, 0x15, 0x1C); // 8 MSB de LED 22
send_uart_frame(0x83, 0x25, 0x02); // 4 LSB de LED 72
send_uart_frame(0x83, 0x05, 0x1C); // 8 MSB de LED 72
HAL_Delay(30);
send_uart_frame(0x81, 0x36, 0x02); // 4 LSB de LED 23
send_uart_frame(0x81, 0x16, 0x1C); // 8 MSB de LED 23
send_uart_frame(0x83, 0x26, 0x02); // 4 LSB de LED 73
send_uart_frame(0x83, 0x06, 0x1C); // 8 MSB de LED 73
HAL_Delay(30);
send_uart_frame(0x81, 0x37, 0x02); // 4 LSB de LED 24
send_uart_frame(0x81, 0x17, 0x1C); // 8 MSB de LED 24
send_uart_frame(0x83, 0x27, 0x02); // 4 LSB de LED 74
send_uart_frame(0x83, 0x07, 0x1C); // 8 MSB de LED 74
HAL_Delay(30);
send_uart_frame(0x82, 0x20, 0x02); // 4 LSB de LED 25
send_uart_frame(0x82, 0x00, 0x1C); // 8 MSB de LED 25
send_uart_frame(0x83, 0x28, 0x02); // 4 LSB de LED 75
send_uart_frame(0x83, 0x08, 0x1C); // 8 MSB de LED 75
HAL_Delay(30);
send_uart_frame(0x82, 0x21, 0x02); // 4 LSB de LED 26
send_uart_frame(0x82, 0x01, 0x1C); // 8 MSB de LED 26
send_uart_frame(0x83, 0x29, 0x02); // 4 LSB de LED 76
send_uart_frame(0x83, 0x09, 0x1C); // 8 MSB de LED 76
HAL_Delay(30);
send_uart_frame(0x82, 0x22, 0x02); // 4 LSB de LED 27
send_uart_frame(0x82, 0x02, 0x1C); // 8 MSB de LED 27
send_uart_frame(0x83, 0x2A, 0x02); // 4 LSB de LED 77
send_uart_frame(0x83, 0x0A, 0x1C); // 8 MSB de LED 77
HAL_Delay(30);
send_uart_frame(0x82, 0x23, 0x02); // 4 LSB de LED 28
send_uart_frame(0x82, 0x03, 0x1C); // 8 MSB de LED 28
send_uart_frame(0x83, 0x2B, 0x02); // 4 LSB de LED 78
send_uart_frame(0x83, 0x0B, 0x1C); // 8 MSB de LED 78
HAL_Delay(30);
send_uart_frame(0x82, 0x24, 0x02); // 4 LSB de LED 29
send_uart_frame(0x82, 0x04, 0x1C); // 8 MSB de LED 29
send_uart_frame(0x83, 0x2C, 0x02); // 4 LSB de LED 79
send_uart_frame(0x83, 0x0C, 0x1C); // 8 MSB de LED 79
HAL_Delay(30);
send_uart_frame(0x82, 0x25, 0x02); // 4 LSB de LED 30
send_uart_frame(0x82, 0x05, 0x1C); // 8 MSB de LED 30
send_uart_frame(0x83, 0x2D, 0x02); // 4 LSB de LED 80
send_uart_frame(0x83, 0x0D, 0x1C); // 8 MSB de LED 80
HAL_Delay(30);
send_uart_frame(0x82, 0x26, 0x02); // 4 LSB de LED 31
send_uart_frame(0x82, 0x06, 0x1C); // 8 MSB de LED 31
send_uart_frame(0x83, 0x2E, 0x02); // 4 LSB de LED 81
send_uart_frame(0x83, 0x0E, 0x1C); // 8 MSB de LED 81
HAL_Delay(30);
send_uart_frame(0x82, 0x27, 0x02); // 4 LSB de LED 32
send_uart_frame(0x82, 0x07, 0x1C); // 8 MSB de LED 32
send_uart_frame(0x83, 0x2F, 0x02); // 4 LSB de LED 82
send_uart_frame(0x83, 0x0F, 0x1C); // 8 MSB de LED 82
HAL_Delay(30);
send_uart_frame(0x84, 0x20, 0x0F); // 4 LSB de LED 33
send_uart_frame(0x84, 0x00, 0xFF); // 8 MSB de LED 33
send_uart_frame(0x84, 0x21, 0x0F); // 4 LSB de LED 34
send_uart_frame(0x84, 0x01, 0xFF); // 8 MSB de LED 34
send_uart_frame(0x84, 0x22, 0x0F); // 4 LSB de LED 35
send_uart_frame(0x84, 0x02, 0xFF); // 8 MSB de LED 35
send_uart_frame(0x84, 0x32, 0x0F); // 4 LSB de LED 83
send_uart_frame(0x84, 0x12, 0xFF); // 8 MSB de LED 83
send_uart_frame(0x84, 0x33, 0x0F); // 4 LSB de LED 84
send_uart_frame(0x84, 0x13, 0xFF); // 8 MSB de LED 84
send_uart_frame(0x84, 0x34, 0x0F); // 4 LSB de LED 85
send_uart_frame(0x84, 0x14, 0xFF); // 8 MSB de LED 85
HAL_Delay(120);
send_uart_frame(0x84, 0x23, 0x0F); // 4 LSB de LED 36
send_uart_frame(0x84, 0x03, 0xFF); // 8 MSB de LED 36
send_uart_frame(0x84, 0x24, 0x0F); // 4 LSB de LED 37
send_uart_frame(0x84, 0x04, 0xFF); // 8 MSB de LED 37
send_uart_frame(0x84, 0x25, 0x0F); // 4 LSB de LED 38
send_uart_frame(0x84, 0x05, 0xFF); // 8 MSB de LED 38
send_uart_frame(0x84, 0x35, 0x0F); // 4 LSB de LED 86
send_uart_frame(0x84, 0x15, 0xFF); // 8 MSB de LED 86
send_uart_frame(0x84, 0x36, 0x0F); // 4 LSB de LED 87
send_uart_frame(0x84, 0x16, 0xFF); // 8 MSB de LED 87
send_uart_frame(0x84, 0x37, 0x0F); // 4 LSB de LED 88
send_uart_frame(0x84, 0x17, 0xFF); // 8 MSB de LED 88
HAL_Delay(120);
send_uart_frame(0x84, 0x26, 0x0F); // 4 LSB de LED 39
send_uart_frame(0x84, 0x06, 0xFF); // 8 MSB de LED 39
send_uart_frame(0x84, 0x27, 0x0F); // 4 LSB de LED 40
send_uart_frame(0x84, 0x07, 0xFF); // 8 MSB de LED 40
send_uart_frame(0x84, 0x28, 0x0F); // 4 LSB de LED 41
send_uart_frame(0x84, 0x08, 0xFF); // 8 MSB de LED 41
send_uart_frame(0x85, 0x20, 0x0F); // 4 LSB de LED 89
send_uart_frame(0x85, 0x00, 0xFF); // 8 MSB de LED 89
send_uart_frame(0x85, 0x21, 0x0F); // 4 LSB de LED 90
send_uart_frame(0x85, 0x01, 0xFF); // 8 MSB de LED 90
send_uart_frame(0x85, 0x22, 0x0F); // 4 LSB de LED 91
send_uart_frame(0x85, 0x02, 0xFF); // 8 MSB de LED 91
HAL_Delay(120);
send_uart_frame(0x84, 0x29, 0x0F); // 4 LSB de LED 42
send_uart_frame(0x84, 0x09, 0xFF); // 8 MSB de LED 42
send_uart_frame(0x84, 0x2A, 0x0F); // 4 LSB de LED 43
send_uart_frame(0x84, 0x0A, 0xFF); // 8 MSB de LED 43
send_uart_frame(0x84, 0x2B, 0x0F); // 4 LSB de LED 44
send_uart_frame(0x84, 0x0B, 0xFF); // 8 MSB de LED 44
send_uart_frame(0x85, 0x23, 0x0F); // 4 LSB de LED 92
send_uart_frame(0x85, 0x03, 0xFF); // 8 MSB de LED 92
send_uart_frame(0x85, 0x24, 0x0F); // 4 LSB de LED 93
send_uart_frame(0x85, 0x04, 0xFF); // 8 MSB de LED 93
send_uart_frame(0x85, 0x25, 0x0F); // 4 LSB de LED 94
send_uart_frame(0x85, 0x05, 0xFF); // 8 MSB de LED 94
HAL_Delay(120);
send_uart_frame(0x84, 0x2C, 0x0F); // 4 LSB de LED 45
send_uart_frame(0x84, 0x0C, 0xFF); // 8 MSB de LED 45
send_uart_frame(0x84, 0x2D, 0x0F); // 4 LSB de LED 46
send_uart_frame(0x84, 0x0D, 0xFF); // 8 MSB de LED 46
send_uart_frame(0x84, 0x2E, 0x0F); // 4 LSB de LED 47
send_uart_frame(0x84, 0x0E, 0xFF); // 8 MSB de LED 47
send_uart_frame(0x85, 0x26, 0x0F); // 4 LSB de LED 95
send_uart_frame(0x85, 0x06, 0xFF); // 8 MSB de LED 95
send_uart_frame(0x85, 0x27, 0x0F); // 4 LSB de LED 96
send_uart_frame(0x85, 0x07, 0xFF); // 8 MSB de LED 96
send_uart_frame(0x85, 0x28, 0x0F); // 4 LSB de LED 97
send_uart_frame(0x85, 0x08, 0xFF); // 8 MSB de LED 97
HAL_Delay(120);
send_uart_frame(0x84, 0x2F, 0x0F); // 4 LSB de LED 48
send_uart_frame(0x84, 0x0F, 0xFF); // 8 MSB de LED 48
send_uart_frame(0x84, 0x30, 0x0F); // 4 LSB de LED 49
send_uart_frame(0x84, 0x10, 0xFF); // 8 MSB de LED 49
send_uart_frame(0x84, 0x31, 0x0F); // 4 LSB de LED 50
send_uart_frame(0x84, 0x11, 0xFF); // 8 MSB de LED 50
send_uart_frame(0x85, 0x29, 0x0F); // 4 LSB de LED 98
send_uart_frame(0x85, 0x09, 0xFF); // 8 MSB de LED 98
send_uart_frame(0x85, 0x2A, 0x0F); // 4 LSB de LED 99
send_uart_frame(0x85, 0x0A, 0xFF); // 8 MSB de LED 99
send_uart_frame(0x85, 0x2B, 0x0F); // 4 LSB de LED 100
send_uart_frame(0x85, 0x0B, 0xFF); // 8 MSB de LED 100
}
else if (state == 0x02) {
// Off state of the LEDs
HAL_Delay(375);
send_uart_frame(0x84, 0x2F, 0x00); // 4 LSB de LED 48
send_uart_frame(0x84, 0x0F, 0x00); // 8 MSB de LED 48
send_uart_frame(0x84, 0x30, 0x00); // 4 LSB de LED 49
send_uart_frame(0x84, 0x10, 0x00); // 8 MSB de LED 49
send_uart_frame(0x84, 0x31, 0x00); // 4 LSB de LED 50
send_uart_frame(0x84, 0x11, 0x00); // 8 MSB de LED 50
send_uart_frame(0x85, 0x29, 0x00); // 4 LSB de LED 98
send_uart_frame(0x85, 0x09, 0x00); // 8 MSB de LED 98
send_uart_frame(0x85, 0x2A, 0x00); // 4 LSB de LED 99
send_uart_frame(0x85, 0x0A, 0x00); // 8 MSB de LED 99
send_uart_frame(0x85, 0x2B, 0x00); // 4 LSB de LED 100
send_uart_frame(0x85, 0x0B, 0x00); // 8 MSB de LED 100
HAL_Delay(120);
send_uart_frame(0x84, 0x2C, 0x00); // 4 LSB de LED 45
send_uart_frame(0x84, 0x0C, 0x00); // 8 MSB de LED 45
send_uart_frame(0x84, 0x2D, 0x00); // 4 LSB de LED 46
send_uart_frame(0x84, 0x0D, 0x00); // 8 MSB de LED 46
send_uart_frame(0x84, 0x2E, 0x00); // 4 LSB de LED 47
send_uart_frame(0x84, 0x0E, 0x00); // 8 MSB de LED 47
send_uart_frame(0x85, 0x26, 0x00); // 4 LSB de LED 95
send_uart_frame(0x85, 0x06, 0x00); // 8 MSB de LED 95
send_uart_frame(0x85, 0x27, 0x00); // 4 LSB de LED 96
send_uart_frame(0x85, 0x07, 0x00); // 8 MSB de LED 96
send_uart_frame(0x85, 0x28, 0x00); // 4 LSB de LED 97
send_uart_frame(0x85, 0x08, 0x00); // 8 MSB de LED 97
HAL_Delay(120);
send_uart_frame(0x84, 0x29, 0x00); // 4 LSB de LED 42
send_uart_frame(0x84, 0x09, 0x00); // 8 MSB de LED 42
send_uart_frame(0x84, 0x2A, 0x00); // 4 LSB de LED 43
send_uart_frame(0x84, 0x0A, 0x00); // 8 MSB de LED 43
send_uart_frame(0x84, 0x2B, 0x00); // 4 LSB de LED 44
send_uart_frame(0x84, 0x0B, 0x00); // 8 MSB de LED 44
send_uart_frame(0x85, 0x23, 0x00); // 4 LSB de LED 92
send_uart_frame(0x85, 0x03, 0x00); // 8 MSB de LED 92
send_uart_frame(0x85, 0x24, 0x00); // 4 LSB de LED 93
send_uart_frame(0x85, 0x04, 0x00); // 8 MSB de LED 93
send_uart_frame(0x85, 0x25, 0x00); // 4 LSB de LED 94
send_uart_frame(0x85, 0x05, 0x00); // 8 MSB de LED 94
HAL_Delay(120);
send_uart_frame(0x84, 0x26, 0x00); // 4 LSB de LED 39
send_uart_frame(0x84, 0x06, 0x00); // 8 MSB de LED 39
send_uart_frame(0x84, 0x27, 0x00); // 4 LSB de LED 40
send_uart_frame(0x84, 0x07, 0x00); // 8 MSB de LED 40
send_uart_frame(0x84, 0x28, 0x00); // 4 LSB de LED 41
send_uart_frame(0x84, 0x08, 0x00); // 8 MSB de LED 41
send_uart_frame(0x85, 0x20, 0x00); // 4 LSB de LED 89
send_uart_frame(0x85, 0x00, 0x00); // 8 MSB de LED 89
send_uart_frame(0x85, 0x21, 0x00); // 4 LSB de LED 90
send_uart_frame(0x85, 0x01, 0x00); // 8 MSB de LED 90
send_uart_frame(0x85, 0x22, 0x00); // 4 LSB de LED 91
send_uart_frame(0x85, 0x02, 0x00); // 8 MSB de LED 91
HAL_Delay(120);
send_uart_frame(0x84, 0x23, 0x00); // 4 LSB de LED 36
send_uart_frame(0x84, 0x03, 0x00); // 8 MSB de LED 36
send_uart_frame(0x84, 0x24, 0x00); // 4 LSB de LED 37
send_uart_frame(0x84, 0x04, 0x00); // 8 MSB de LED 37
send_uart_frame(0x84, 0x25, 0x00); // 4 LSB de LED 38
send_uart_frame(0x84, 0x05, 0x00); // 8 MSB de LED 38
send_uart_frame(0x84, 0x35, 0x00); // 4 LSB de LED 86
send_uart_frame(0x84, 0x15, 0x00); // 8 MSB de LED 86
send_uart_frame(0x84, 0x36, 0x00); // 4 LSB de LED 87
send_uart_frame(0x84, 0x16, 0x00); // 8 MSB de LED 87
send_uart_frame(0x84, 0x37, 0x00); // 4 LSB de LED 88
send_uart_frame(0x84, 0x17, 0x00); // 8 MSB de LED 88
HAL_Delay(120);
send_uart_frame(0x84, 0x20, 0x00); // 4 LSB de LED 33
send_uart_frame(0x84, 0x00, 0x00); // 8 MSB de LED 33
send_uart_frame(0x84, 0x21, 0x00); // 4 LSB de LED 34
send_uart_frame(0x84, 0x01, 0x00); // 8 MSB de LED 34
send_uart_frame(0x84, 0x22, 0x00); // 4 LSB de LED 35
send_uart_frame(0x84, 0x02, 0x00); // 8 MSB de LED 35
send_uart_frame(0x84, 0x32, 0x00); // 4 LSB de LED 83
send_uart_frame(0x84, 0x12, 0x00); // 8 MSB de LED 83
send_uart_frame(0x84, 0x33, 0x00); // 4 LSB de LED 84
send_uart_frame(0x84, 0x13, 0x00); // 8 MSB de LED 84
send_uart_frame(0x84, 0x34, 0x00); // 4 LSB de LED 85
send_uart_frame(0x84, 0x14, 0x00); // 8 MSB de LED 85
HAL_Delay(30);
send_uart_frame(0x82, 0x27, 0x00); // 4 LSB de LED 32
send_uart_frame(0x82, 0x07, 0x00); // 8 MSB de LED 32
send_uart_frame(0x83, 0x2F, 0x00); // 4 LSB de LED 82
send_uart_frame(0x83, 0x0F, 0x00); // 8 MSB de LED 82
HAL_Delay(30);
send_uart_frame(0x82, 0x26, 0x00); // 4 LSB de LED 31
send_uart_frame(0x82, 0x06, 0x00); // 8 MSB de LED 31
send_uart_frame(0x83, 0x2E, 0x00); // 4 LSB de LED 81
send_uart_frame(0x83, 0x0E, 0x00); // 8 MSB de LED 81
HAL_Delay(30);
send_uart_frame(0x82, 0x25, 0x00); // 4 LSB de LED 30
send_uart_frame(0x82, 0x05, 0x00); // 8 MSB de LED 30
send_uart_frame(0x83, 0x2D, 0x00); // 4 LSB de LED 80
send_uart_frame(0x83, 0x0D, 0x00); // 8 MSB de LED 80
HAL_Delay(30);
send_uart_frame(0x82, 0x24, 0x00); // 4 LSB de LED 29
send_uart_frame(0x82, 0x04, 0x00); // 8 MSB de LED 29
send_uart_frame(0x83, 0x2C, 0x00); // 4 LSB de LED 79
send_uart_frame(0x83, 0x0C, 0x00); // 8 MSB de LED 79
HAL_Delay(30);
send_uart_frame(0x82, 0x23, 0x00); // 4 LSB de LED 28
send_uart_frame(0x82, 0x03, 0x00); // 8 MSB de LED 28
send_uart_frame(0x83, 0x2B, 0x00); // 4 LSB de LED 78
send_uart_frame(0x83, 0x0B, 0x00); // 8 MSB de LED 78
HAL_Delay(30);
send_uart_frame(0x82, 0x22, 0x00); // 4 LSB de LED 27
send_uart_frame(0x82, 0x02, 0x00); // 8 MSB de LED 27
send_uart_frame(0x83, 0x2A, 0x00); // 4 LSB de LED 77
send_uart_frame(0x83, 0x0A, 0x00); // 8 MSB de LED 77
HAL_Delay(30);
send_uart_frame(0x82, 0x21, 0x00); // 4 LSB de LED 26
send_uart_frame(0x82, 0x01, 0x00); // 8 MSB de LED 26
send_uart_frame(0x83, 0x29, 0x00); // 4 LSB de LED 76
send_uart_frame(0x83, 0x09, 0x00); // 8 MSB de LED 76
HAL_Delay(30);
send_uart_frame(0x82, 0x20, 0x00); // 4 LSB de LED 25
send_uart_frame(0x82, 0x00, 0x00); // 8 MSB de LED 25
send_uart_frame(0x83, 0x28, 0x00); // 4 LSB de LED 75
send_uart_frame(0x83, 0x08, 0x00); // 8 MSB de LED 75
HAL_Delay(30);
send_uart_frame(0x81, 0x37, 0x00); // 4 LSB de LED 24
send_uart_frame(0x81, 0x17, 0x00); // 8 MSB de LED 24
send_uart_frame(0x83, 0x27, 0x00); // 4 LSB de LED 74
send_uart_frame(0x83, 0x07, 0x00); // 8 MSB de LED 74
HAL_Delay(30);
send_uart_frame(0x81, 0x36, 0x00); // 4 LSB de LED 23
send_uart_frame(0x81, 0x16, 0x00); // 8 MSB de LED 23
send_uart_frame(0x83, 0x26, 0x00); // 4 LSB de LED 73
send_uart_frame(0x83, 0x06, 0x00); // 8 MSB de LED 73
HAL_Delay(30);
send_uart_frame(0x81, 0x35, 0x00); // 4 LSB de LED 22
send_uart_frame(0x81, 0x15, 0x00); // 8 MSB de LED 22
send_uart_frame(0x83, 0x25, 0x00); // 4 LSB de LED 72
send_uart_frame(0x83, 0x05, 0x00); // 8 MSB de LED 72
HAL_Delay(30);
send_uart_frame(0x81, 0x34, 0x00); // 4 LSB de LED 21
send_uart_frame(0x81, 0x14, 0x00); // 8 MSB de LED 21
send_uart_frame(0x83, 0x24, 0x00); // 4 LSB de LED 71
send_uart_frame(0x83, 0x04, 0x00); // 8 MSB de LED 71
HAL_Delay(30);
send_uart_frame(0x81, 0x33, 0x00); // 4 LSB de LED 20
send_uart_frame(0x81, 0x13, 0x00); // 8 MSB de LED 20
send_uart_frame(0x83, 0x23, 0x00); // 4 LSB de LED 70
send_uart_frame(0x83, 0x03, 0x00); // 8 MSB de LED 70
HAL_Delay(30);
send_uart_frame(0x81, 0x32, 0x00); // 4 LSB de LED 19
send_uart_frame(0x81, 0x12, 0x00); // 8 MSB de LED 19
send_uart_frame(0x83, 0x22, 0x00); // 4 LSB de LED 69
send_uart_frame(0x83, 0x02, 0x00); // 8 MSB de LED 69
HAL_Delay(30);
send_uart_frame(0x81, 0x31, 0x00); // 4 LSB de LED 18
send_uart_frame(0x81, 0x11, 0x00); // 8 MSB de LED 18
send_uart_frame(0x83, 0x21, 0x00); // 4 LSB de LED 68
send_uart_frame(0x83, 0x01, 0x00); // 8 MSB de LED 68
HAL_Delay(30);
send_uart_frame(0x81, 0x30, 0x00); // 4 LSB de LED 17
send_uart_frame(0x81, 0x10, 0x00); // 8 MSB de LED 17
send_uart_frame(0x83, 0x20, 0x00); // 4 LSB de LED 67
send_uart_frame(0x83, 0x00, 0x00); // 8 MSB de LED 67
HAL_Delay(30);
send_uart_frame(0x81, 0x2F, 0x00); // 4 LSB de LED 16
send_uart_frame(0x81, 0x0F, 0x00); // 8 MSB de LED 16
send_uart_frame(0x82, 0x37, 0x00); // 4 LSB de LED 66
send_uart_frame(0x82, 0x17, 0x00); // 8 MSB de LED 66
HAL_Delay(30);
send_uart_frame(0x81, 0x2E, 0x00); // 4 LSB de LED 15
send_uart_frame(0x81, 0x0E, 0x00); // 8 MSB de LED 15
send_uart_frame(0x82, 0x36, 0x00); // 4 LSB de LED 65
send_uart_frame(0x82, 0x16, 0x00); // 8 MSB de LED 65
HAL_Delay(30);
send_uart_frame(0x81, 0x2D, 0x00); // 4 LSB de LED 14
send_uart_frame(0x81, 0x0D, 0x00); // 8 MSB de LED 14
send_uart_frame(0x82, 0x35, 0x00); // 4 LSB de LED 64
send_uart_frame(0x82, 0x15, 0x00); // 8 MSB de LED 64
HAL_Delay(30);
send_uart_frame(0x81, 0x2C, 0x00); // 4 LSB de LED 13
send_uart_frame(0x81, 0x0C, 0x00); // 8 MSB de LED 13
send_uart_frame(0x82, 0x34, 0x00); // 4 LSB de LED 63
send_uart_frame(0x82, 0x14, 0x00); // 8 MSB de LED 63
HAL_Delay(30);
send_uart_frame(0x81, 0x2B, 0x00); // 4 LSB de LED 12
send_uart_frame(0x81, 0x0B, 0x00); // 8 MSB de LED 12
send_uart_frame(0x82, 0x33, 0x00); // 4 LSB de LED 62
send_uart_frame(0x82, 0x13, 0x00); // 8 MSB de LED 62
HAL_Delay(30);
send_uart_frame(0x81, 0x2A, 0x00); // 4 LSB de LED 11
send_uart_frame(0x81, 0x0A, 0x00); // 8 MSB de LED 11
send_uart_frame(0x82, 0x32, 0x00); // 4 LSB de LED 61
send_uart_frame(0x82, 0x12, 0x00); // 8 MSB de LED 61
HAL_Delay(30);
send_uart_frame(0x81, 0x29, 0x00); // 4 LSB de LED 10
send_uart_frame(0x81, 0x09, 0x00); // 8 MSB de LED 10
send_uart_frame(0x82, 0x31, 0x00); // 4 LSB de LED 60
send_uart_frame(0x82, 0x11, 0x00); // 8 MSB de LED 60
HAL_Delay(30);
send_uart_frame(0x81, 0x28, 0x00); // 4 LSB de LED 9
send_uart_frame(0x81, 0x08, 0x00); // 8 MSB de LED 9
send_uart_frame(0x82, 0x30, 0x00); // 4 LSB de LED 59
send_uart_frame(0x82, 0x10, 0x00); // 8 MSB de LED 59
HAL_Delay(30);
send_uart_frame(0x81, 0x27, 0x00); // 4 LSB de LED 8
send_uart_frame(0x81, 0x07, 0x00); // 8 MSB de LED 8
send_uart_frame(0x82, 0x2F, 0x00); // 4 LSB de LED 58
send_uart_frame(0x82, 0x0F, 0x00); // 8 MSB de LED 58
HAL_Delay(30);
send_uart_frame(0x81, 0x26, 0x00); // 4 LSB de LED 7
send_uart_frame(0x81, 0x06, 0x00); // 8 MSB de LED 7
send_uart_frame(0x82, 0x2E, 0x00); // 4 LSB de LED 57
send_uart_frame(0x82, 0x0E, 0x00); // 8 MSB de LED 57
HAL_Delay(30);
send_uart_frame(0x81, 0x25, 0x00); // 4 LSB de LED 6
send_uart_frame(0x81, 0x05, 0x00); // 8 MSB de LED 6
send_uart_frame(0x82, 0x2D, 0x00); // 4 LSB de LED 56
send_uart_frame(0x82, 0x0D, 0x00); // 8 MSB de LED 56
HAL_Delay(30);
send_uart_frame(0x81, 0x24, 0x00); // 4 LSB de LED 5
send_uart_frame(0x81, 0x04, 0x00); // 8 MSB de LED 5
send_uart_frame(0x82, 0x2C, 0x00); // 4 LSB de LED 55
send_uart_frame(0x82, 0x0C, 0x00); // 8 MSB de LED 55
HAL_Delay(30);
send_uart_frame(0x81, 0x23, 0x00); // 4 LSB de LED 4
send_uart_frame(0x81, 0x03, 0x00); // 8 MSB de LED 4
send_uart_frame(0x82, 0x2B, 0x00); // 4 LSB de LED 54
send_uart_frame(0x82, 0x0B, 0x00); // 8 MSB de LED 54
HAL_Delay(30);
send_uart_frame(0x81, 0x22, 0x00); // 4 LSB de LED 3
send_uart_frame(0x81, 0x02, 0x00); // 8 MSB de LED 3
send_uart_frame(0x82, 0x2A, 0x00); // 4 LSB de LED 53
send_uart_frame(0x82, 0x0A, 0x00); // 8 MSB de LED 53
HAL_Delay(30);
send_uart_frame(0x81, 0x21, 0x00); // 4 LSB de LED 2
send_uart_frame(0x81, 0x01, 0x00); // 8 MSB de LED 2
send_uart_frame(0x82, 0x29, 0x00); // 4 LSB de LED 52
send_uart_frame(0x82, 0x09, 0x00); // 8 MSB de LED 52
HAL_Delay(30);
send_uart_frame(0x81, 0x20, 0x00); // 4 LSB de LED 1
send_uart_frame(0x81, 0x00, 0x00); // 8 MSB de LED 1
send_uart_frame(0x82, 0x28, 0x00); // 4 LSB de LED 51
send_uart_frame(0x82, 0x08, 0x00); // 8 MSB de LED 51
}
else {
// Delay
HAL_Delay(100);
}
}
// The LED is turned off indicating that the transfer is finished
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
lastState = state;
/* USER CODE END 3 */
}
Am I missing something or not doing something right?
