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.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
7 posts / 0 new
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:1 day 14 hours 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

Thanks for your reply.

Would you help to review my sample code ? l have add the callback but not work.

// Test.cpp : Defines the entry point for the console application.
//

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

using namespace 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;

result = udll_start_prog();
cout << result << endl;
//********************************************************
result = 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:1 day 14 hours 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.

  • All the action _SUCCESS (e.g. UDLL_SPI_ERASE_SUCCESS) callbacks will come after the tests are done. This means that the (e.g.) erase test will take some seconds to finish, and it depends on your flash memory.

  • 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

Thank you so much.

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:1 day 14 hours ago
Staff
加入:2018-02-08 11:03
Hi Louis Wang2,

Hi Louis Wang2,

We have a PLT board that controls all the devices for all the procedures and it resets the connected devices when it is needed. Although, if you don’t have the PLT hardware, you could press the reset button when your procedures is started and hold it until the UDLL_FW_DOWNLOAD_START callback function hits. I suggest you to add the following messages in the previous attached code, in order to know when you should press and release the reset button.

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.