I'm currently stuck using DALI protocol with D4i drivers. I want to access the memory bank of one driver and read the energy parameters.
I know the opcode to read memory locations is 0xC5, since the description of this opcode is "Returns the content of the memory location stored in DTR0 that is located within the memory bank listed in DTR1"
My problem is that, since I'm implementing DALI protocol using C, at basic level, I'm not really sure how to send a DALI command that uses the opcode, states that the memory location is DTR0 and the memory bank is DTR1. I attach a snippet of code that states how I'm sending DALI commands:
// Logic 1 (0-->1)
void sendDaliHigh(void)
{
nrf_gpio_pin_clear(BOARD_DALI_TX_PIN);
waitTEus();
nrf_gpio_pin_set(BOARD_DALI_TX_PIN);
waitTEus();
}
// Logic 1 (0-->1)
void sendDaliStartBit(void)
{
nrf_gpio_pin_clear(BOARD_DALI_TX_PIN);
waitTEus();
nrf_gpio_pin_set(BOARD_DALI_TX_PIN);
waitTEus();
}
uint32_t sendDaliV1ForwardFrame(uint8_t command)
{
sendDaliStartBit();
sendDaliHigh();
sendDaliHigh();
sendDaliHigh();
sendDaliHigh();
sendDaliHigh();
sendDaliHigh();
sendDaliHigh();
sendDaliHigh();
// Check every bit and
for (uint8_t i = 0; i < 8; i++)
{
// Mask to check every bit
if ((command & (128 >> i)) != 0)
{
sendDaliHigh();
// LOG(LVL_INFO, "1");
}
else
{
sendDaliLow();
// LOG(LVL_INFO, "0");
}
}
sendStopBit();
sendStopBit();
return 95 * 100;
}
So basically, if I want to send the command STEP DOWN AND OFF, all I have to write is:
sendDaliV1ForwardFrame(0x07);
But since all I do is sending an opcode, I'm not really sure on how to access memory banks. Basically, I want to retrieve the Active Energy from this driver. According to DiiA Spectification DALI Part 252, accessing memory bank is this table:
I read all the different DALI documents (201, 202, various user guides), but they never specify on how to send the commands or access the memory banks at byte or logical level.
How I should proceed in order to retrieve memory locations in bank?