跳到主要内容

Automate OTP Programming over UART

4 years ago

Automate OTP Programming over UART

张贴了MikeY0分 12回复
0 upvotes

Hello Dialog,

我试图完全自动化OTP编程process. For hardware, I have a custom interface board that uses an FTDI 230X chip. For firmware, I have a HEX file and OTP Header file that I am flashing.

I am currently able to use the CLI to program OTP. However, I would like to avoid using the RESET pin or having any sort of user intervention for my script. One of the features of the FTDI chip I am using is that it has GPIOs that can be programmed for bit banging. One of these GPIOs can be toggled for RESET. Is there any way that I can create my own bare programming script that eliminates the need for the Reset button press, and just invokes the FTDI chip to do it? I know the command for the FTDI chip. I just don't know how to invoke it on the Dialog side.

Thank you and regards,

Michael

4 years ago

MT_dialog -30点

嗨Mikey,

I am not sure i understand your question, i suppose that you can reset the 580 through the reset pin by using the extra gpio on the FTDI chip, just like hitting the reset button.

谢谢MT_dialog

4 years ago

MikeY 0分

嗨mt_dialog,

Yes, that is what I'm trying to do, but how can I do that using either the SmartSnippets CLI or some other way? I can't seem to figure out where to write that code in the SDK5 utilities (if that is where it goes).

此致,

MikeY

4 years ago

MikeY 0分

我认为,在/smartsnippets/resources/programmer_es5.bin中需要发生变化,这是我目前在我的CLI脚本中使用的程序员文件。你有洞察力吗?

4 years ago

MT_dialog -30点

嗨Mikey,

We haven't tried anything similar to what you are trying to do, but i dont think that you need to change any of the tools provided by dialog. The ES5.bin is the programmer for the OTP and the board needs to be reset before downloading the ES5 code in the 580. I suppose that you need somekind of automation tool that will be triggering the FTDI in order to reset the board after you get the indication for reseting the board and continues with the rest of the batch file after the reset.

谢谢MT_dialog

4 years ago

MikeY 0分

Hi,

对,那是正确的。您是否知道任何此类工具,或者也许是如何创建一个?

根据我的理解,SmartSnippets要求将重置按钮按下电路板并等待。按下重置按钮后,UART会有一些通信,以告诉PC已按下重置按钮。我想做的就是告诉FTDI芯片在SmartSnippets发送Reset按请求后脉冲其GPIO之一。

Regards,

迈克y.

4 years ago

MT_dialog -30点

嗨Mikey,

抱歉,如前所述,我们从未尝试过这种方案,我无法建议任何特定的工具或为您提供创建这种操作的脚本的指导。

谢谢MT_dialog

4 years ago

Lovejoey 0分

嗨mt_dialog,

I have the same question as Mike, I have 2 questions

1, Can we get rid of the reset signal while we are programming the chip.

2,如果问题1答案是否,那么我们可以使用脚本来模拟编程过程。因为在固件下载处于过程中,我未能访问USB芯片。也许摆脱信号的唯一方法是模拟整个下载过程。

谢谢

4 years ago

MT_dialog -30点

嗨lovejoey,

1)如何通过JTAG或通过UART编程芯片?在这两种情况下,它建议拥有重置,如果580被编程和睡眠,则无法安装调试器,如果由于编程过程,如果由于编程过程而出现问题,则建议使用重置引脚。

2)我不完全得到第二个问题,你是什么意思“脚本来模拟编程过程”,你能说更具描述性吗?

谢谢MT_dialog

4 years ago

Lovejoey 0分

HI MT

1)我们在UART上编程DA14580 ..让我们一起越过这个过程:
You open an CLI and call Smartsnippets.exe to load Programming_ES5.bin into the DA14580 chip
After you execute the command the CLI will print a message to ask you to press the reset button on board.
Above reflects the problem I have now. I want to send out the hardware reset signal by Computer not by human. So as you said neither of JTAG and UART method could not get rid of sending reset signals. I've tried to use a python script to monitor the CLI output and sent out a reset signal using the same usb chip which is connected with DA14580. But the USB chip is occupied by COM communication. So I'm not able to send out the reset signal.

2) Simulate the Smartsnippets process is not accurate. It should be rewrite all the chip programming process using a python script. In this way, i need to know what the Smartsnippets do while it is programming the Da14580 chip.

谢谢
杨凯

4 years ago

MT_dialog -30点

嗨lovejoey,

You can't emulate the reset signal without the reset pin, the reason Smart Snippets asks for the reset pin when download via UART is in order for the bootloader to run and then Smart Snippest pushes the binary into the UART as soon as it tracks the STX = 0x02 (as soon as smart snippets detects the STX character from the bootloader it indicates "Reset signal detected" at the console) that indicates the begining of the UART booting procedure. So after the reset signal hits (that the user has to push and not Smart Snippets) the UART booting sequence begins and Smart Snippets follows the procedure described in the AN-B-001 document regarding the UART booting procedure. The JTAG doesn't need a reset to occur since it has direct access to the 580 as long as the debugger module in the 580 is enabled. In case the debbuger module is disabled (the 580 runs a fw with sleep) you will again need the reset button in order run the primary bootloader and the primary bootloader to reenable the debugger module.

I understand that you would like to a signal to toggle the reset pin but as far as i can tell there is not something on Smart snippets or the CLI programmer that can provide you that option.

谢谢MT_dialog

4 years ago

MikeY 0分

嗨mt_dialog,

我们正在尝试做的是仿真SmartSnippets所做的,但添加了FTDI 230x的软件重置。如果我们能够理解CLI进程,那么我认为我们可以在Python中创建一个脚本,该脚本将完成相同的过程,也使用230x GPIO功能向DA14580发送复位脉冲。

The CLI commands that we use are:
command1 = 'SmartSnippets.exe -type booter -chip DA14580-01 -com_port comnum -gpio P0_4 -uart P0_0 -file %USERPROFILE%/SmartSnippets/resources/programmer_ES5.bin

command2 = 'SmartSnippets.exe -type otp -chip DA14580-01 -com_port comnum -baudrate 57600 -gpio P0_4 -uart P0_0 -firmware %USERPROFILE%/SmartSnippets/resources/programmer_ES5.bin -cmd write_custom_code -file /path/to/OTPFirmwareFile/file.hex -offset 0x0'

command3 ='smartsnippets.exe -Type OTP -Chip DA14580-01 -Com_Port Comnum -BaudRate 57600-GPIO P0_4 -uart P0_0 -Firmware Programmer_ES5.bin -cmd write_header -file /path/to/totheaderfile/file.hex'

What is the purpose of the first command? Is it to set up the FTDI chip to understand how to talk to the DA14580 and send the SOH byte after it receives the STX byte? Or is it an instruction set for the DA14580? What exactly is the binary doing? After this command, it is necessary to press the hardware reset button, which I assume means that we need to restart the boot process so that the bootloader. The App Flag is still 0x0000, so the chip boots into Dev Mode.

我假设第二命令是我们开始UART引导协议的地方。该芯片发送STX和PC(?)响应固件的SOH,LEN_LSB和LEN_MSB,DA14580发送ACK字节。然后,它从PC等待我们的十六进制文件,并在地址0x20000000开始加载它。完成此操作后,DA14580发送CRC,主机必须使用ACK字节响应。在此之后,Sys_CTRL_REG寄存器被编程为重新映射到SYSRAM并应用软复位。

We can now send our OTP header, which is done in the 3rd command. Is there anything that needs to be received from the DA14580 before we can start issuing this hex file? Is there any boot sequence we need to follow? What is the process here?

After the OTP header has been programmed, we can now hard reset the DA14580 and expect our firmware to load, is that correct?

4 years ago

MT_dialog -30点

嗨Mikey,

第一个命令通过-file选项下载fw设置(在您的情况下,580应该有待编程OTP的ES5_Programmer),580 EMMITS是在启动加载程序运行时的字节,并且580为FW等待将下载。STX由580发送,并且检测0x02被检测到的智能代码段假定已按下复位并启动指示的序列。您无需调用您指示的命令(提及的前2个),您可以直接应用第二个命令,程序员将被下载,然后写入WRITE_CUSTOM_CODE中所示的-file作为您的形象或作为头部。

要汇总-Firmware Firfware_file您指示命令的命令将在执行指定命令之前下载如果您不在命令中使用此参数,则应使用已指示的第一个命令,以便580成为使用ES5_Programmer编程,然后您可以发出下一个命令。因此,需要重置才能为引导加载程序运行,以便检测到STX,使程序员_ES5.bin被下载到580中。

您可以在命令行实现部分找到所有CLI命令和解释SmartSnippetshelp.pdf中的所有COMAN,帮助文件位于Smart Scompets目录中。您可以打开SS并单击“帮助”选项,然后选择UserGuide.pdf

在OTP标题中刻录OTP和应用程序标志后,当您按RESET按钮时,OTP应用程序应加载到SYSRAM。

谢谢MT_dialog