Programm SPI Flash: UART works, JTAG error ... address 81FE8

something-big-is-coming.jpg

10 posts / 0 new
Last post
gme_johannes
Offline
Last seen: 3 weeks 1 day ago
Joined: 2017-12-22 10:09
Programm SPI Flash: UART works, JTAG error ... address 81FE8

Dear dialog support,

I have a custom board with Murara ZY module (DA14580), attached is an SPI flash Winbond W25X20.
I program the DA14580 directly, or the flash via UART through Smart Snippets v4.8.3.1804 . I use the IoT Kit programmer board [edit: the CIB].
Both boards are connected through a 15 cm flat ribbon cable at J4.

When connecting via UART, I can Connect, Read, Erase, Burn successfully, the firmware will be loaded at boot-up and I can work with the device.

When connecting via JTAG (SWD), the connection seems to be established successfully:


[INFO General @18-08-12 21:01:50] Could not measure total IR len. TDO is constant high.
[INFO General @18-08-12 21:01:50] Could not measure total IR len. TDO is constant high.
[INFO General @18-08-12 21:01:50] Found SWD-DP with ID 0x0BB11477
[INFO General @18-08-12 21:01:50] FPUnit: 4 code (BP) slots and 0 literal slots
[INFO General @18-08-12 21:01:50] Found Cortex-M0 r0p0, Little endian.
[INFO General @18-08-12 21:01:50] BTLE device selected.

Loading the SPI Flash firmware sees to work, too:


[INFO SPI Flash @18-08-12 21:04:25] Found SWD-DP with ID 0x0BB11477
[INFO SPI Flash @18-08-12 21:04:25] FPUnit: 4 code (BP) slots and 0 literal slots
[INFO SPI Flash @18-08-12 21:04:25] Found Cortex-M0 r0p0, Little endian.
[INFO SPI Flash @18-08-12 21:04:25] Firmware File C:\Program Files (x86)\Dialog\SmartSnippetsStudio\Toolbox\common_resources\jtag_programmer.bin has been selected for downloading.
[INFO SPI Flash @18-08-12 21:04:25] Successfully downloaded firmware file to the board.
[INFO SPI Flash @18-08-12 21:04:25] Successfully configured SPI Flash ports and pins.

Reading does not work (nor does flash/erase)


[INFO SPI Flash @18-08-14 22:22:06] Started reading 32768 bytes from memory.
[ERROR SPI Flash @18-08-14 22:22:06] Failed reading memory at address 81FE8.
[ERROR SPI Flash @18-08-14 22:22:06] Failed reading memory.

The configuration is identical for both cases (SPI Flash pin configuration, SPI Flash options, SPI Flash memory size (HEX, in Bytes), see attached pdf.

Do you have any idea what could be going wrong?

Best regards
Johannes

Attachment: 
Device: 
PM_Dialog
Online
Last seen: 8 min 7 sec ago
Staff
Joined: 2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

I am not able to understand what you want to do. Do you want to program your custom board or the murata module through JTAG and using SmartSnippets tool? What do you mean with the “IoT Kit programmer board” ? Do you mean the Communication Interface Board (CIB)? Please, provide more specific information abaut the connection diagram in order to give you the proper answer.

Thanks, PM_Dialog

gme_johannes
Offline
Last seen: 3 weeks 1 day ago
Joined: 2017-12-22 10:09
I have acquired the IoT

I have acquired the IoT Sensor Development Kit coming with the CIB, yes.
Using this CIB, I try to program a custom board with Murata ZY and attached Winbond W25X20.

With UART it works -> the memory can be programmed, and the Murata ZY will load the firmware from the flash.
With SWD it does not work.
What confuses me is that SWD does seem to work and it does establish a connection to the module, yet programming the flash fails.
See above logs.

Which other information do you require?

gme_johannes
Offline
Last seen: 3 weeks 1 day ago
Joined: 2017-12-22 10:09
Is it possible that flash

Is it possible that flash_programmer.bin (which is used for UART) supports the W25X20, whereas jtag_programmer.bin does not?
Should I modify and rebuilt this firmware?
Edit: I have investigated DA1458x_SDK\5.0.4\utilities\flash_programmer and to me (as a layman) it looks like the W25X20 support does not discriminate between UART/JTAG.
Furthermore GPIOs seem to be pulled up, which is good as I have other sensors sharing the SPI bus (anyway it was working fine with UART so I did not expect this would be the culprit).

Also I see a possible relation to this thread:
https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...
Do you have the document available which is mentioned there? Can it be helpful?

PS: I realize I should have posted this in the "Tools" forum? Maybe you can move it.

gme_johannes
Offline
Last seen: 3 weeks 1 day ago
Joined: 2017-12-22 10:09
I have now noticed that

I have now noticed that reading and programm the flash via SWD works fine, as long as the W25X20 is empty.

1. Flash is programmed, device boots from flash, works fine
2. Open SS Toolbox with SWD -> behaves as described in initial post
3. Open SS Toolbox with UART -> delete flash
4. Open SS Toolbox with SWD -> can read flash successfully (all empty = FF) [see first log below]
5. attempt to write flash -> successful, but immediate (automatic) readback fails [see second log below]
6. Successful flash programming confirmed, since device boots from flash again and works fine

First log

[INFO General @18-08-19 11:01:22] Could not measure total IR len. TDO is constant high.
[INFO General @18-08-19 11:01:22] Could not measure total IR len. TDO is constant high.
[INFO General @18-08-19 11:01:22] Found SWD-DP with ID 0x0BB11477
[INFO General @18-08-19 11:01:22] FPUnit: 4 code (BP) slots and 0 literal slots
[INFO General @18-08-19 11:01:22] Found Cortex-M0 r0p0, Little endian.
[INFO General @18-08-19 11:01:22] BTLE device selected.
[INFO SPI Flash @18-08-19 11:03:16] Header records have been removed from hex file wrbl_sfl_580.hex.
[INFO SPI Flash @18-08-19 11:03:16] Read 30776 bytes from file wrbl_sfl_580.hex.
[INFO SPI Flash @18-08-19 11:03:18] Found SWD-DP with ID 0x0BB11477
[INFO SPI Flash @18-08-19 11:03:18] FPUnit: 4 code (BP) slots and 0 literal slots
[INFO SPI Flash @18-08-19 11:03:18] Found Cortex-M0 r0p0, Little endian.
[INFO SPI Flash @18-08-19 11:03:19] Firmware File C:\Program Files (x86)\Dialog\SmartSnippetsStudio\Toolbox\common_resources\jtag_programmer.bin has been selected for downloading.
[INFO SPI Flash @18-08-19 11:03:19] Successfully downloaded firmware file to the board.
[INFO SPI Flash @18-08-19 11:03:19] Successfully configured SPI Flash ports and pins.
[INFO SPI Flash @18-08-19 11:03:33] Started reading 32768 bytes from memory.
[INFO SPI Flash @18-08-19 11:03:34] Reading has finished. Read 32768 bytes.

Second log

[INFO SPI Flash @18-08-19 11:05:01] Started burning memory with 31096 bytes of data at address 0x00000.
[INFO SPI Flash @18-08-19 11:05:01] Memory burning completed successfully.
[INFO SPI Flash @18-08-19 11:05:01] Reading memory to refresh memory contents....
[ERROR SPI Flash @18-08-19 11:05:01] Failed reading memory at address 81FE8.
[ERROR SPI Flash @18-08-19 11:05:01] Failed reading memory.

PM_Dialog
Online
Last seen: 8 min 7 sec ago
Staff
Joined: 2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

In case that you want to connect and the read the SPI flash while it is empty, the most possible reason is because of your firmware disable the debugger. So, could you please check if your firmware disables the debugger?  Also, when the flash in not empty, can you please press the reset button and then try to connect and read the SPI flash?

Thanks, PM_Dialog

gme_johannes
Offline
Last seen: 3 weeks 1 day ago
Joined: 2017-12-22 10:09
Hi PM_Dialog,

Hi PM_Dialog,

as is shown in the log

[INFO SPI Flash @18-08-12 21:04:25] Firmware File C:\Program Files (x86)\Dialog\SmartSnippetsStudio\Toolbox\common_resources\jtag_programmer.bin has been selected for downloading.
[INFO SPI Flash @18-08-12 21:04:25] Successfully downloaded firmware file to the board.
[INFO SPI Flash @18-08-12 21:04:25] Successfully configured SPI Flash ports and pins.

the jtag_programmer.bin firmware is successfully loaded to the device. Hence, at this point, my firmware is not running anymore... (which I can also tell by the behavior of an LED).
Can it be that the device is not being fully reset in the process of loading jtag_programmer.bin (???) and that some registers in the DA14580 are still programmed as they were by my firmware (e.g. the disabled debugger)?

Furthermore, how can it be that reading the flash fails immediately after I have programmed it suxcessfully one time?
After all, the new firmware is not immediately loaded from the flash since the device is not reset.

PM_Dialog
Online
Last seen: 8 min 7 sec ago
Staff
Joined: 2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

It is not possible that the device is not being fully reset in the process of loading jtag_programmer.bin. Did you check if your firmware disables the debugger? I tried to reproduce your issue, but I am able to connect/read successfully the SPI flash while is not empty.

Thanks, PM_Dialog

gme_johannes
Offline
Last seen: 3 weeks 1 day ago
Joined: 2017-12-22 10:09
Hi PM_Dialog,

Hi PM_Dialog,

I do not understand your argument, since you said yourself: As soon as jtag_programmer.bin is successfully loaded (which according to the log it is), the device was fully reset - hence no remnant of my firmware should be present in the device, and it shouldn't matter whatever my firmware does.

Nevertheless let me answer your question:
the firmware does not disable the debugger, although indeed I have implemented this option for two LEDs connected to the associated ports.
I have made sure not to disable the debugger nor use the associated GPIO ports. I have verified it as I can easily tell by the LEDs being operational or not.


#ifdef USE_JTAG_AS_GPIO
SetBits16(SYS_CTRL_REG, DEBUGGER_ENABLE, 0);
#else
SetBits16(SYS_CTRL_REG, DEBUGGER_ENABLE, 1);
#endif


#ifdef USE_JTAG_AS_GPIO
#define LEDG_PORT GPIO_PORT_1
#define LEDG_PIN GPIO_PIN_5
#define LEDB_PORT GPIO_PORT_1
#define LEDB_PIN GPIO_PIN_4
#endif

Still I can not read the flash when it is programmed.

PM_Dialog
Online
Last seen: 8 min 7 sec ago
Staff
Joined: 2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

Please try to program the SPI flash through JTAG and when the procedure finished press the reset button from the CIB, and then try to connect and read the SPI flash. Could you please let me know if that is working? As I am able to see from you last post, you the debugger is not disable, but in fact that is a custom board, I am not able to replicate your issue.

Thanks, PM_Dialog