Booting from an external CPU with integrated Flash memory

16 posts / 0 new
Last post
bensalemsaif
Offline
Last seen:3 years 8 months ago
加入:2016-02-02 12:42
Booting from an external CPU with integrated Flash memory

Hello MT_dialog,

I use the DA14580 development Kit-Basic and with the AN-B-023 I successfully loaded my project into the Flash memory (W25X20CL) and booted from it using SPI.

Now, I want to connect it to an STMicroelectronics STM32F103R8 using SPI, is it possible to load my project into it's internal flash memory and boot from it as I did with the DA14580 ? Or should I I implement a booting protocol in the ST Microcontroller to send data over SPI to my BLE module (slave) ?

Thank you very much and regards,

-- Saif

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi bensalemsaif,

Hi bensalemsaif,

I dont get exactly what is that you want to do. When the 580 boots the primary bootloader expects a specific sequence of bytes on specific ports (SPI master/ SPI slave among other interfaces). Please check the AN-B-001 - Booting from serial interfaces for more information about the booting sequence.

Thanks MT_dialog

bensalemsaif
Offline
Last seen:3 years 8 months ago
加入:2016-02-02 12:42
hi MT_dialolog,

hi MT_dialolog,

Thank you for your answer, In fact, I allready checked the AN-B-001 and my question is :
I will integrate the PAN1740 module into an STMicroelectronics STM32F103R8 , and I want it to boot from the flash memory of the ST Microcontroller using SPI , so to do that, should I send my data to the 580 as described in the AN-B-001 ?

Because what I did before, is just using Smartsnippets, I loaded my Hex file into the SPI Flash memory and the 580 could boot, it could not be the same with an integrated flash memory in a ST Microcontroller ? without implementing how data should be sent over SPI...

Thank you,
Saif

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi bensalemsaif,

Hi bensalemsaif,

The AN-B-001 describes the booting procedure in all 580's interfaces, on power on, the 580's bootloader will run and you should provide the proper data over the interface you choose (SPI in your case master/slave configuration) in order to start the booting seqence. There is an example in the SDK between 2 580's one as master and the other as slave over an SPI interface with the #define SPI_BOOTER you can choose your master device to download the .bin to your slave. The example is under host_apps/da1458x/proximity/reporter.

Thanks MT_dialog

bensalemsaif
Offline
Last seen:3 years 8 months ago
加入:2016-02-02 12:42
Hi MT_dialog,

Hi MT_dialog,

Thank you for your support , the reporter example is so helpful !
So now to extract the image data from an .hex file , I removed the address, then the CRC and I kept only data, and I replaced gaps by 0x00 , then I put the data into a buffer, is it correct ?

Thank you,
Saif

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi bensalemsaif,

Hi bensalemsaif,

The file to be downloaded is the .bin file not the .hex file, you can convert the .hex to .bin from the hex2bin tool from the utilities folder in the SDK, open th .bin with an editor, copy and paste the data in your .c file, and download.

Thanks MT_dialog

bensalemsaif
Offline
Last seen:3 years 8 months ago
加入:2016-02-02 12:42
Hi MT_dialog,

Hi MT_dialog,

谢谢你,我现在实现为你说,to be sure that my Pin configuration is OK, I did like described in the AN-B-001 : P-0-0 <-> SCK , P0_3 <-> CS , P0_5 <-> MOSI and P0_6 <-> MISO , and for other pins, should I put jumper ? (TCK,TMS,BATS)
Second point is about timing, I should send data exactly when boot algorithm in 580 is searching for data on SPI, so how long it takes before the 5 times looped and JTAG is enabled ? what is the best way to do that ?

Thank you,

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi bensalemsaif,

Hi bensalemsaif,

The TCK, TMS are the debuger pins if you would like to download your .bin through keil you have to use those pins if not you can ommit them as well the BATS pin is the pin for the SPI memory on board of the development kit. Please check the schematics for the development kit you own. Also yes, you should send the data while the bootloader is running in order for the downloading to be succesful, it should start immidiatelly, the exact timeouts for the steps of the booting procedure are described in the AN-B-001 document.

Thanks MT_dialog

bensalemsaif
Offline
Last seen:3 years 8 months ago
加入:2016-02-02 12:42
Hello MT_dialog,

Hello MT_dialog,

I'm still not able to boot from my SPI Master Microcontroller, so please could you verify this for me :

我开始在580年通过控制复位销智慧h my Microcontroller, waited for 103ms as described in "AN-B-01" , and then strated sending the header (enable CS and send data) as done in the reporter example.. but I have never received the ACK or NACK , sometimes I got data on MISO just when I strating sending the header, please find attached a screenshot of header sending analysis with Saleae.

Have I missed something ?

Thank you,

Attachment:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi bensalemsaif,

Hi bensalemsaif,

Working with the spi slave on the 580 is a bit tricky, please make sure that the SPI clock provided by the master is at least four times smaller that the internal SPI clock configuration on the slave, also please experiment with putting some delay on the master when sending data on the SPI bus. Also please check your connections, they should be as short as possible, shielded and properly terminated.

Thanks MT_dialog

bensalemsaif
Offline
Last seen:3 years 8 months ago
加入:2016-02-02 12:42
Hello MT_dialog,

Hello MT_dialog,

Thank you for your reply, I will check my connections, and for the clock, the internal frequency on 580 is 16MHz that's right ? until now I'm sending data with master clock frequency = 250KHz, so it should be OK right ?

For putting some delay when sending data, I tried it but it seems not logic sence it will take so much time to send the image , it could be OK for the header but not for the image, so please confirm for the clock frequency and I will check my connections.

Thank you,
--Saif

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi bensalemsaif,

Hi bensalemsaif,

The internal SPI clock frequency can reach 16MHz the (maximum/minimum divider is 1). Please check the AN-B-001 for the proper settings on the SPI clock when the 580 boots from an SPI master. Since your master is sending data in frequency up to 250KHz you should be ok since 500 is the limit without issuing any delays between the sending bytes. The SPI sampler in the 580 is quite sensetive and the wire cables can cause lot problems since it can mistakenly receive small spikes or reflections as pulses.

Thanks MT_dialog

bensalemsaif
Offline
Last seen:3 years 8 months ago
加入:2016-02-02 12:42
Hello MT_dialog,

Hello MT_dialog,

Since SPI didn't work, I'm trying to boot from UART, so like before , I reset the 580 and then strat sending data when I receive the 0x02 strat byte, then when sending SOH , LEN_LSB and LEN_MSB I got the 0x06 ACK , so everything was OK , then I strat sending the image, but after that I didn't get any CRC.
The same image was successfully downloaded into SPI Flash memory (Smartsnippets)and 580 could boot from it.
Here attached the Saleae analysis , my hex and bin files (size is 19236 =4B24 )and how I'm sending data :

1- Like the reporter example : data is aligned(64), the size is divided by 4 and I'm using the same sending function implementation
2- data not aligned , just a normal buffer with the length = size of data and sending it's content byte by byte
But always the same result, is there anything missing ?

Attachment:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi bensalemsaif,

Hi bensalemsaif,

I am not able to open the Booting from UART.logicdata file (seems that the file is empty). Just take the binary as produced from the hex2bin program and download it through UART. If you dont wait for a CRC and send a 0x06 what is the 580 does ? Also you can try to run the secondary bootloader in order to debug this, you can run bootloader over keil and emulate the primary bootloader and debug it. Also are you able to download the file over UART using the smart snippets? Additionally you can try to boot from a different pair TX/RX if available. I ve uploded a capture from how a UART download image is.

Thanks MT_dialog

Attachment:
bensalemsaif
Offline
Last seen:3 years 8 months ago
加入:2016-02-02 12:42
Hello Mt_dialog,

Hello Mt_dialog,

In fact I'm not able to download the file (or any file) using SmartSnippets over SPI/UART , it's done only over JTAG, otherwise, I can't erase the SPI flash memory, here attached the error:
So what could be the problem due to ?

Thanks,

Attachment:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi bensalemsaif,

Hi bensalemsaif,

Since you have a basic kit the only available option in smart snippets is the UART, the UART/SPI is only available for the pro and the expert kit. To program the SPI Flash have you made the proper connections on the basic kit (it requires an additional connection), please follow the the figure next to your pins for the connection of the SPI and additionally you have to connect the P0_4 jumper and also connect the P0_5 with the UART pin.

Thanks MT_dialog