I tried to play with nrf52840 and ade7953 .
At the begining, I use PC uart application to do the following test and everything works well.
Here are the testing steps:
1. Send 0x35 0x01 0x02 to ADE7953 and the application gets response value 0x8004 correctly.
2. Try the power-up procedure by writing 0xAD to Register Address 0xFE and writing 0x30 to Register Address 0x120 with commands:
0xCA 0x00 0xFE 0xAD 0x00
0xCA 0x01 0x20 0x30 0x00
3. Send 0x35 0x01 0x20 and get 0x30 0x00.
The test looked good, but when I tried to connect Nordic nrf52840 and ADE7953 by uart with the same tests,
the step 3 failed. I Send 0x35 0x01 0x20 and get 0x00. I connect nrf52840DK and ADE7953 by UART with pins 0.08(RX) and 0.06 (TX).
Can anyone help? Here are my test code
void meter_init() {
static uint8_t dataArray[6] = {0xCA, 0x00, 0xFE, 0xAD, 0x00, 0x00};
ret_code_t err_code;
// Write 0xAD to Register Address 0xFE:This unlocks Register 0x120
for (uint32_t i = 0; i < 5; i++) {
do {
err_code = app_uart_put(dataArray[i]);
if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY)) {
NRF_LOG_ERROR("Failed sync to apm. Error 0x%x. ", err_code);
APP_ERROR_CHECK(err_code);
}
} while (err_code == NRF_ERROR_BUSY);
}
nrf_delay_ms(10);
// Write 0x30 to Register Address 0x120: This configures the optimum settings
dataArray[0] = 0xCA;
dataArray[1] = 0x01;
dataArray[2] = 0x20;
dataArray[3] = 0x30;
dataArray[4] = 0x00;
for (uint32_t i = 0; i < 5; i++) {
do {
err_code = app_uart_put(dataArray[i]);
if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY)) {
NRF_LOG_ERROR("Failed sync to apm. Error 0x%x. ", err_code);
APP_ERROR_CHECK(err_code);
}
} while (err_code == NRF_ERROR_BUSY);
}
nrf_delay_ms(10);
}