Error in SWD Debug for custom board application: Failed to read memory

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
sshersh
Level 3
Level 3
First solution authored 10 replies posted 5 questions asked

Hello, 

I'm trying to program a PSOC6 to blink an on-board LED using the HAL. It is 2 lines of code besides the usual enabling interrupts which I copied from an example. I'm using the Miniprog4 programmer. I can power on the programmer and connect to the PSOC using Cypress Programmer, but the LED doesn't blink.  Similarly, I get no errors when I run "make program" or "make debug" in the CLI but nothing happens.  But when I debug in ModusToolbox I get a bunch of "Failed to read memory" errors.

Another thing to note is the miniprog4 power doesn't turn on when I program the device through ModusToolbox or the CLI so I've had to power the board externally when not using Cypress Programmer. 

Here are my OpenOCD config options:

 

-s "${openocd_path}/../scripts"
-s "./libs/TARGET_PSOC6-GENERIC/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource"
-c "source [find interface/kitprog3.cfg]"
-c "puts stderr {Started by GNU MCU Eclipse}"
-c "source [find target/psoc6.cfg]"
-c "psoc6.cpu.cm4 configure -rtos auto -rtos-wipe-on-reset-halt 1"
-c "gdb_port 3332"
-c "psoc6 sflash_restrictions 1"
-c "init; reset init"

 

 

Given that Cypress Programmer can connect to the PSOC device, why can't I succesfully program it? 

 

0 Likes
1 Solution

Hello, 

I restarted the project from scratch and carefully followed the steps to create a new BSP, and now it works. The issue was that I copied over a design.modus file from another project which seemed to mess something up. 

Best, 

Sam

View solution in original post

0 Likes
4 Replies
YuZh
Moderator
Moderator
Moderator
100 replies posted 10 likes received 50 sign-ins

Hi:

Could you tell me your chip version? And according to your log, probably your chip version doesn't match your MTB selected. Please check your makefile.

zhichao

zhichao

0 Likes
sshersh
Level 3
Level 3
First solution authored 10 replies posted 5 questions asked

Hi Zhichao, 

I'm now getting a more serious issue. I was previously able to program and debug the PSOC with the cortex-debug extension in VScode, but now I get an error where I'm unable to continue or interrupt the debugger. It seems this issue happens when I get stuck in startup_psoc6_02_cm4.S

sshersh_0-1667839438632.png

When I manually reset the PSOC the issue goes away. Is this maybe due to to a timing error in the reset signal during programming? 

Best, 

Sam Shersher

0 Likes

Hello, 

I restarted the project from scratch and carefully followed the steps to create a new BSP, and now it works. The issue was that I copied over a design.modus file from another project which seemed to mess something up. 

Best, 

Sam

0 Likes
sshersh
Level 3
Level 3
First solution authored 10 replies posted 5 questions asked

Hi Zhichao, 

My chip is CY8C614AAZI-S2F44, and I have the line DEVICE:=CY8C614AAZI-S2F44 in my BSP makefile. 

I was able to solve this specific issue by setting sflash-restrictions to 0 disabling programming the factory flash, and then I was able to program and debug normally. 

However, I've been trying to get retarget-io to work but the cy_retarget_io_init() function returns 67247872 which is an error code. I connected the UART RX and TX to the miniprog4 RX and TX and initialized the right pins as UART in the device configurator. I'm not sure why I can't initialize the IO interface. 

Best, 

Sam Shersher

0 Likes