How to use u_dll.dll API for firmware download and memory programming

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
7个帖子/ 0新
Last post
Louis Wang2
Offline
Last seen:2 years 9 months ago
加入:2018-01-18 06:49
How to use u_dll.dll API for firmware download and memory programming

Hi Dialog

Do you have sample codes of showing how to use u_dll.dll API (DA1458x_DA1468x_PLT_v_4.2.0.160 )for firmware download and memory programming

We are trying to use u_dll.dll API to download FW and erase SPI flash ,

udll_set_prog_params ,udll_set_device_params and udll_start_prog all return successfully, but it doesn't not work.

*********

we have run udll_init() and add callback function . but it still doesn't work.

Best Regard,
Louis Wang

Device:
PM_Dialog
Offline
Last seen:21 min ago
Staff
加入:2018-02-08 11:03
Hi Louis Wang2,

Hi Louis Wang2,

It is recommended to call the udll_init() function before any other operation with the u_dll.dll library, because it sets to zero some internal structures.The fact that the udll_start_prog() returns UDLL_SUCCESS messages doesn’t mean that the process of the programming is already finished. In order to find where the process is, you should check the callback function that you call in the udll_start_prog(). Then, the u_dll.dll will execute your callback in order to inform you in which point your code is.

Thanks, PM_Dialog

Louis Wang2
Offline
Last seen:2 years 9 months ago
加入:2018-01-18 06:49
Hi Dialog

Hi Dialog

感谢您的回复。

您有帮助查看我的示例代码吗?l已添加回调但不起作用。

// test.cpp:定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "u_dll.h"
#include
#include "string.h"

使用命名空间std;

void my_callback(uint32_t com_port_number,int status,void * data,uint32_t data_len);

int main(int argc, char* argv[])
{
int result = 1;
_udll_params udll_params_t;
_udll_device_params device_params_t;
//********************************************************
cout << "Test 000 start:" << endl;
result = udll_init();
cout << result << endl;
//********************************************************
result = 1;
udll_params_t.dut_ic = U_DUT_IC_DA14585;
udll_params_t.params_580。dut_ic = U_DUT_IC_DA14585;
udll_params_t.params_580。baud_rate = 57600;
udll_params_t.params_580.mem.action = fw_load;
udll_params_t.params_580。mem.fw_load.action = FW_LOAD;
udll_params_t.params_580。mem.fw_load.en = false;

string FW_Path("E:\\DA1458x_DA1468x_PLT_v_4.2.0.160\\executables\\binaries\\flash_programmer_580.bin");
strcpy_s(udll_params_t.params_580.mem.fw_load.fw_path, FW_Path.c_str());

udll_params_t.params_580。mem.fw_load.uart_change_pins = false;
udll_params_t.params_580。mem.fw_load.uart_boot_pins = P04_P05;
udll_params_t.params_580。mem.fw_load.uart_pins.uart_port_tx = 0;
udll_params_t.params_580。mem.fw_load.uart_pins.uart_pin_tx = 4;
udll_params_t.params_580。mem.fw_load.uart_pins.uart_port_rx = 0;
udll_params_t.params_580。mem.fw_load.uart_pins.uart_pin_rx = 5;

result = udll_set_prog_params(&udll_params_t);
cout << result << endl;
//********************************************************
result = 1;
device_params_t.is_active = true;
device_params_t.dut_num = U_DUT_1;
device_params_t.com_port_boot = 5;
device_params_t.com_port_prog = 5;
device_params_t.bd_addr[BD_ADDR_SIZE] = uint8_t(0);
device_params_t.otp_customer_field.data [otp_585_customer_field_size] = uint8_t(0);
device_params_t.OTP_customer_field.size = 100;
device_params_t.xtal_trim_val [xtal_trim_size] = uint8_t(0);
device_params_t.adc_calib_val = 0;
device_params_t.mem_data[MAX_MEM_DATA_SIZE] = uint8_t(0);
device_params_t.user_callback_udll = My_CallBack;

result = udll_set_device_params(&device_params_t);
cout << result << endl;

结果= udll_start_prog();
cout << result << endl;
//********************************************************
结果= udll_close();
cout << result << endl;
return 0;
}

void my_callback(uint32_t com_port_number,int status,void * data,uint32_t data_len)
{
cout << "test" << endl;
}

PM_Dialog
Offline
Last seen:21 min ago
Staff
加入:2018-02-08 11:03
Hi Louis Wang2,

Hi Louis Wang2,

The attached code is only a sample in order to check how you can burn/erase the SPI flash and download firmware, but it is NOT tested. You can see how the PLT-DLL uses the UDLL for more details. When changing tests you should always use the udll_set_prog_params function, but you can skip udll_set_device_params if there are no device specific changes.

If you use more than one device, the above procedure has to be done per device. UDLL can handle up to 16 devices simultaneously, but you will have to set different callbacks and different checks per device. The attached code is only for a single device per run. If you have the SPI flash in different GPIO pins than the default, you will have to set the configuration in each SPI test, even if you have set it in the previous one. It is recommended to use timers for each status callback change. Some useful points in order to understand how it works.

  • All the action _START (e.g. UDLL_SPI_ERASE_START) callbacks will come immediately after calling the udll_start_prog.

  • 完成测试后,所有操作_success(例如UDLL_SPI_ERASE_SUCCESS)回调将是回调。这意味着(例如)擦除测试将需要几秒钟即可完成,这取决于闪存。

  • FW_LOAD time to complete is about 5-6 seconds.

Thanks, PM_Dialog

Attachment:
Louis Wang2
Offline
Last seen:2 years 9 months ago
加入:2018-01-18 06:49
Hi Dialog

Hi Dialog

非常感谢。

Followed your detailed guidance , my code can work ( erase ,burn file to spi flash) now.

But , sometimes , some special DUTs, need a reset signal before burn FW to DUT , if using smartsnippet tool box , it would prompt "press hardware reset button".

By using u_dll API , How to know whether the DUT need a reset signal?

PM_Dialog
Offline
Last seen:21 min ago
Staff
加入:2018-02-08 11:03
Hi Louis Wang2,

Hi Louis Wang2,

我们有一个PLT板,可以控制所有程序的所有设备,并且在需要时重置连接的设备。虽然,如果您没有PLT硬件,虽然如果您的过程启动并保持其直到UDLL_FW_DOWNLOAD_START回调函数命中,则可以按下重置按钮。我建议您在上一个附加的代码中添加以下消息,以便知道何时应按并释放重置按钮。

Line 25 : cout << "Press and hold the reset button" << endl;

Line 111-112 : cout << "Release the reset button.." << endl;

Thanks, PM_Dialog

Louis Wang2
Offline
Last seen:2 years 9 months ago
加入:2018-01-18 06:49
Hi Dialog

Hi Dialog

Thanks , l will add it into my codes.