15 posts / 0 new
Last post
kqtrinh
Offline
Last seen:3 years 10 months ago
加入:2016-08-24 00:17
DA14580 Basic Kit SDK

Questions about the 580 DSPS peripheral mode FW code I would like to use as the starting point for our custom embedded software development.

As of right now, i would like to understand the mechanism of how Keil IDE or SmartSnippets which downloads the FW bit stream from the Host PC thru the USB connection to the MCU on the 580 to receive the bit stream and write to flash or load it into RAM. Upon power up, I believe the 580 will load the FW from Flash into RAM and starts execution. However, when the 580 has no FW currently resides in flash, I would think there should exist a piece of code that's running in RAM that will handle writing the incoming FW from SmartSnippets or Keil to flash or to RAM. This piece of code might be called ROM code kind of like the BIOS fw in the PC. Can you point me to the part of the code that handles flash or RAM upload interface? If i am totally off base, please educate me so i understand how this process works to help me in our custom development.

If there is a document that explains this process in details, that would be even better.

Thank you,
--Khai

Device:
MT_dialog
Offline
Last seen:3 months 3 days ago
工作人员
加入:2015-06-08 11:34
嗨kqtrinh,

嗨kqtrinh,

You can have a look at the AN-B-001.pdf or the UM-B-012.pdf, those documents mention how the booting sequence works, where the code is downloaded and runs. The code that exists in the 580 and loads a external fw is called the primary bootloader (or just bootloader) and its located in the ROM memory area. The source code isn't available, but its functionallity is described in the AN-B-001 document, its an ammount of options for the 580 to download code via UART/SPI/I2C.

Thanks MT_dialog

kqtrinh
Offline
Last seen:3 years 10 months ago
加入:2016-08-24 00:17
Thank you for the timely

Thank you for the timely response. These 2 docs helped me understand a little more about how the 580 booting process works.

It's OK the ROM code isn't available, will the secondary bootloader as described in the UM-B-012.pdf doc available or other sample code that is close to its functionality for booting from flash.
Maybe I will try to describe my development scenario and you can recommend how it can be done. With the basic kit, I can debug the FW directly by loading the code to SRAM with Keil and I can also write to flash with SmartSnippets at the moment. There is also writing to OTP with SmartSnippets which I haven't had a need to use at the moment.

Our custom board is quite simple. It consists of the 580 in the frontend interface over BLE interface with a phone app. The 580 will receive messages from the phone and send it over to a Display device through the 580 internal UART bus.

To debug the 580 application code, we will build an external debugger board (is there such a board exist on the market?) with the Atmel chip (not on the same board with the 580 due to size constraint). Basically separating the 580 basic kit into 2 boards.

So looking at this HW design, there will be flash area for the 580 application code. The Display chip that connects to the 580 UART interface also has FW code that it needs to boot from and execute. We want both the 580 application code and the Display FW code to be in the same flash memory (I don't think we need OTP memory unless there is a reason for it.)

My questions with the booting sequence for our development board below:

1. With the HW design above, I need a mechanism to read/write Flash to load the 580 application code from Flash to SRAM. Is this the job of the secondary bootloader? But using the secondary bootloader requires OTP onboard. Is source code for the secondary bootloader available or something similar?

2. Assuming the 580 is now up and running booting from Flash, it needs to act as an external Host controller to the Display device. It needs to read Flash for the Display device FW and send it over UART to the Display device so it can now boot.

That is my approach to the booting sequence for our dev board at the moment. From what you can see, we need code to read/write Flash and dump it to SRAM as well as dump it on to the UART bus by the 580 CPU.

You feedback and recommendation is appreciated...

Thanks,
--Khai

MT_dialog
Offline
Last seen:3 months 3 days ago
工作人员
加入:2015-06-08 11:34
嗨kqtrinh,

嗨kqtrinh,

Yes the secondary bootloader can be found in the utilities folder in the SDK and its quite similar with the primary bootloader. Regarding the debugger module you can use a Segger Jlink Lite ARM debugger, the same debugger that the expert kit uses. Regarding your questions:

1) In order to load the fw from the flash to the 580 sysram you dont need a secondary bootloader, the primary will be able to do that for you as long as you follow the default pin connections for the SPI booting. The secondary bootloader is for assigning different booting pins, turning on the flash in case you turn it off for low power consumption, load different images (SUOTA functionality etc). As a mentioned the secondary bootloader source code is available in the utilities directory in the SDK.

2) If the display chip needs a fw i suppose that the 580 needs to send that fw, if the chip isn't able to download it directly from the flash, so yes you need a routine where the 580 will read the flash and send it to the display over UART. The 580 will exetute the normal booting sequence and after that it will act as a middleman between the display and the flash.

Thanks MT_dialog

kqtrinh
Offline
Last seen:3 years 10 months ago
加入:2016-08-24 00:17
Is there sample code to

Is there sample code to reading/writing from/to Flash?
Thanks,
--Khai

MT_dialog
Offline
Last seen:3 months 3 days ago
工作人员
加入:2015-06-08 11:34
嗨kqtrinh,

嗨kqtrinh,

There is a driver for writing in the flash and there is also an example that interacts with the flash, the example is located in the SDK at the peripheral_examples projects in the spi directory. And also as mentioned previously there is the secondary_bootloader source code in the utilities directory. Please check the below SDK directories.

DA1458x_SDK\5.0.4\utilities\secondary_bootloader : the secondary bootloader

DA1458x_SDK\5.0.4\projects\target_apps\peripheral_examples\spi : the spi flash example

Thanks MT_dialog

kqtrinh
Offline
Last seen:3 years 10 months ago
加入:2016-08-24 00:17
Regarding to your answer to

Regarding to your answer to question 1 above, If I understand correctly, I don't need the secondary bootloader to do what I need. The primary bootloader can do the job. Then my questions are:

1. Does the primary bootloader reside in ROM? If so, do I have to manually load the primary bootloader to ROM for every chip when we go production? Or this process was already done for us when we receive the DA14580s for production?

2. Assuming the DA application FW resides in SPI Flash, where in external SPI Flash address does the primary loader read the FW from to download to SysRAM? Is it by default address 0? Is this starting address programmable?

Thanks,
--Khai

kqtrinh
Offline
Last seen:3 years 10 months ago
加入:2016-08-24 00:17
Follow up questions:

Follow up questions:

1. How does external PC application such as SmartSnippets have direct access (read/write/erase FW) to 580 external flash. Can I use SmartSnippets to flash data file for the FW application to consume? Does it have to bind to some format to upload this data file to flash?

2. Once FW is on external Flash, ROM primary bootloader must need to know 2 piece of info: address and size of FW to load to SRAM. Does SmartSnippets have these information set somewhere in flash so ROM has a knowledge so it can load the FW to SRAM?

3.With the data file in flash, the FW application code also needs to know the address and size of where the data is stored in flash so it can read and consume the data.

Thanks,
--Khai

MT_dialog
Offline
Last seen:3 months 3 days ago
工作人员
加入:2015-06-08 11:34
嗨kqtrinh,

嗨kqtrinh,

1) The primary bootloader is allready burned in ROM and the functionallity of the loader is described in the AN-B-001.pdf document, in general it provides you some standard pins in order to boot via UART/SPI/I2C. The bootloader will execute as soon as you power up your device, you dont have to burn the bootloader since as i ve allready mentioned it is allready located in ROM.

2) The bootloader when the procedure is flash related and the 580 executes as master it will access the address 0 of the flash memory, in the primary bootloader this is not programmable. All those info are documented in the .pdf i mentioned.

Regarding the follow up questions:

1) When smart snippets is instructed to connect to 580 in order to program the flash it downloads a small fw named flash_programmer or jtag_programmer, that fw handles all the commands from Smart Snippets (Erase/Burn etc ). Yes you can use smart snippets to flash your fw application. Regarding the format question, i dont quite get it, the SS will take the .hex convert it to .bin or you can place the .bin file directly and the tool will burn it on your flash.

2)请阅读手册我已经表明the procedure that the bootloader follows.

3) As i mentioned, the 580 in SPI mode will request data from address 0 from the flash and the flash should start sending the image. The image has to be bootable and that means that it should have the bootable header and the length of the code - measured and assigned by smart snippets if the bootable option is selected. So what Smart Snippets will additionally do is to attach the 0x70 0x50 header in order to indicate that the image is bootable apply some zero padding and attach the size of the .bin file.

Thanks MT_dialog

kqtrinh
Offline
Last seen:3 years 10 months ago
加入:2016-08-24 00:17
Let me clarify my questions a

Let me clarify my questions a little better.

所以哒应用FW装载在flash的开始ing at address 0 so the primary loader upon power up can read from Flash and write it to SysRAM. Upon completely booted and running in SysRAM, the custom FW requires some data from flash to perform its task. This is the input data to some algorithm in the custom FW that we intended to write. This was the question I asked previously about the data file. Can I use SS to upload data file to Flash for my custom FW to consume after it was booted? This data file is not a bootable image. It's just some data that is required in the FW algorithm. For SS to be able to burn this data file to flash, does it need to follow some format so SS will recognize it and able to burn it to Flash?

Thanks,
--Khai

MT_dialog
Offline
Last seen:3 months 3 days ago
工作人员
加入:2015-06-08 11:34
嗨kqtrinh,

嗨kqtrinh,

Yes Smart Snippets is able to burn your custom data into the flash, you can use either the propriety header Programmer or even the Flash burner, there isn't any specific format to follow in order to burn data into the flash using smart snippets. You can test this by burning a random binary file to your dev kits flash at some address.

Thanks MT_dialog

kqtrinh
Offline
Last seen:3 years 10 months ago
加入:2016-08-24 00:17
I would like to learn how

I would like to learn how SmartSnippets uses flash_programmer or jtag_programmer to /write/erase flash. Do you have source code for them?

Thanks,
--Khai

kqtrinh
Offline
Last seen:3 years 10 months ago
加入:2016-08-24 00:17
never mind. Found it.

never mind. Found it.

kqtrinh
Offline
Last seen:3 years 10 months ago
加入:2016-08-24 00:17
Is there an application note

Is there an application note that talks about flash_programmer utility?

MT_dialog
Offline
Last seen:3 months 3 days ago
工作人员
加入:2015-06-08 11:34
嗨kqtrinh,

嗨kqtrinh,

No, there is no application note that documents the functionallity of the jtag_programmer. This fw is ment to be used by the Smart Snippets tool and not as a code reference.

Also please dont post a new question on an irrelevant topic, you can always create a new post.

Thanks MT_dialog