ciniml / ExtFlashLoader

External flash loader library for Wio Terminal
Boost Software License 1.0
20 stars 1 forks source link

NO TF CARD #2

Open Kabron287 opened 4 years ago

Kabron287 commented 4 years ago

Seems to be very useful program but... I successfully upload it, it runs, did Write/Verify/Launching menu steps and then blinking NO TF CARD message appeared.

Card 16GB was formatted as FAT32 and tested with Seeed_Arduino_FS-1.1.0 SD_Test example. The only bug was that listDir never works.

What could be done to diagnose? I could debug it with J-Link under VisualGDB.

Thanks in advance, Vladimir

ciniml commented 4 years ago

Sorry for late response. I've uploaded the binary of menu app in "examples/WriteSampleMenu" directory on "no_sd" branch as "SimpleLoader.elf".

https://github.com/ciniml/ExtFlashLoader/tree/no_sd/examples/WriteSampleMenu

Could you tell me what's happening on your Wio Terminal and SD card?

pjh64 commented 3 years ago

I ran into the same issue. It detects the Flash by ID (ef, 4016) but keeps showing NO TF CARD when done loading. Also the same happens on your 'no-sd'-branch. I'm using a 16 GB SD (sandisk) that contains a few binaries I've exported from Arduino IDE.

UPDATE: Got a little further. The program expects the bin files within their own directories in /apps/ as mentioned in the readme. After I understood the expected structure within the SD card it was easy to make it start loading the desired bin files. Still I'm having issues running them. Tried out loading the basic blink-example from the Arduino IDE which didn't run but froze the device until reflashing it in bootloader-mode.

kartben commented 3 years ago

Hi @ciniml! Any chance you could share the source for the menu app? It is the only binary that I seem to be able to load using ExtFlashLoader (all the other get stuck in the DPLL init code, if that rings a bell?) so I would love to see if its startup code is by any chance any different from the default Seeed SAMD Arduino core?

Thank you!

ciniml commented 3 years ago

Hi @kartben . Here is the source code of the menu app, which is written as an application on MPLAB Harmony.

https://github.com/ciniml/WioTerminalSimpleLoader/tree/simple_loader/firmware

I almost forgot the structure of the source code since I wrote this around 9 months ago, so it takes a bit time to answer questions about the code.

kartben commented 3 years ago

Thanks for the super fast reply! I will have a look and see if there seems to be anything specific that appears to be needed for running from QSPI. You don't remember anything weird happening or having to be adapted with clock initialization code when running from QSPI Flash, do you?

ciniml commented 3 years ago

Actually, running codes from QSPI flash requires faster clock to keep QSPI working, so the initialization code of the menu app does not change GCLK0 (main clock) to slower clock like XOSC32K.

I remember that the clock initialization code of Seeed's Arduino_core_samd change the clock source of GCLK0 to XOSC32K, initialize the DFLL0 and then revert clock source of GCLK0 to DFLL, which causes Arduino application fails to boot from QSPI flash.

Thus I've decided to develop the menu app without Arduino core by using MPLAB Harmony.