Part Number: EVM430-F6736
Tool/software:
Good afternoon!
I hope this thread find you well
I'm using the EVM430F6736 and I'm trying to read calirbation values manually, by sending HEX commands, through UART, using an ESP32, to the Smart Meter.
I've previously used this technique to read Electrical parameters values (Vrms, Irms...) and it s working fine (so the wiring and the peripehrals works well).
However As I changed the commands to read the existing calibration values in the EVM430, I didn't receive what I expected.
I sent the following command:
{0x55, 0xAA, 0x05, 0x04, 0x03, 0x00, 0x07, 0x00}
However I received : (A.K.A the Uart message received was)
{0x55, 0xAA, 0x05, 0x04, 0x03, 0x01, 0x08, 0x00}
I will provide now the full task used to send and the logs (Ps: I'm programming the ESP32 using Esspressif IDE)
The code :
/**
* @brief Task to calibrate Active power. This task will not be part of the final
* running code but will be kept in here for possible future calibration needs
*
* @param arg Task arguments (unused)
*/
void EVM_calibration_task(void *arg)
{
uart_event_t event;
// Allocate buffers for receiving and processing data
uint8_t* rx_buffer = (uint8_t*) malloc(RX_BUF_SIZE + 1);
uint16_t rx_buffer_length;
// Command sequence for asking for Data : Set the EVM430 to Active state
uint8_t tx_flag_command[8] = {0x55, 0xAA, 0x05, 0x04, 0x03, 0x00, 0x07, 0x00};
static const char *TX_TASK_TAG = "EVM_Calibration_task";
esp_log_level_set(TX_TASK_TAG, ESP_LOG_INFO);
ESP_LOGI(TX_TASK_TAG, "Starting calibration task");
// Send each byte of the command with delay between bytes
for (int i = 0; i < 8; i++)
{
sendData(TX_TASK_TAG, tx_flag_command[i]);
vTaskDelay(1 / portTICK_PERIOD_MS);
}
while(1)
{
if (xQueueReceive(g_uart_queue, (void *)&event, 4000 / portTICK_PERIOD_MS))
{
rx_buffer_length= uart_read_bytes(UART_NUM_1, rx_buffer, RX_BUF_SIZE, 500 / portTICK_PERIOD_MS);
ESP_LOG_BUFFER_HEXDUMP(TX_TASK_TAG, rx_buffer, rx_buffer_length, ESP_LOG_INFO);
ESP_LOGI(TX_TASK_TAG, "Calibration values received! Length: %d",rx_buffer_length);
}else
{
ESP_LOGI(TX_TASK_TAG,"No values received");
}
}
vTaskDelete(NULL); // Delete this task after completion
}
Logs:
I (7238) EVM_Calibration_task: Starting calibration task
I (7248) EVM_Calibration_task: Wrote 1 bytes
I (7248) EVM_Calibration_task: Wrote 1 bytes
I (7258) EVM_Calibration_task: Wrote 1 bytes
I (7258) EVM_Calibration_task: Wrote 1 bytes
I (7268) EVM_Calibration_task: Wrote 1 bytes
I (7268) EVM_Calibration_task: Wrote 1 bytes
I (7278) EVM_Calibration_task: Wrote 1 bytes
I (7278) EVM_Calibration_task: Wrote 1 bytes
I (7288) main_task: Returned from app_main()
I (7788) EVM_Calibration_task: 0x3ffd9bc4 55 aa 05 04 03 01 08 00 |U.......|
I (7788) EVM_Calibration_task: Calibration values received! Length: 8
I (11788) EVM_Calibration_task: No values received