Hi all,
I have a problem with reading from RAM whet I set aligment to 1 byte. Strange is that reading in 4-bytes aligment is OK.
My setup is:
Open On-Chip Debugger 0.10.0+dev-00957-g9de7d9c8 (2019-11-15-13:16)
stlink-3
stm32g431
I'm using openocd as lib.
// this is ok res = api->read_mem(handle, RAM_START, 4, ramKb * 0x100, buf); // here we fail (-7) res = api->read_mem(handle, RAM_START, 1, ramKb * 0x100, buf);
and log:
Info : 10 16 stlink_usb.c:1040 stlink_usb_version(): STLINK V3J4M2 (API v3) VID:PID 0483:374E
Debug: 11 17 stlink_usb.c:1264 stlink_usb_init_mode(): MODE: 0x01
Info : 12 19 stlink_usb.c:1072 stlink_usb_check_voltage(): Target voltage: 3.279681
Debug: 13 19 stlink_usb.c:1319 stlink_usb_init_mode(): MODE: 0x01
Debug: 14 21 stlink_usb.c:2539 stlink_dump_speed_map(): Supported clock speeds are:
Debug: 15 21 stlink_usb.c:2542 stlink_dump_speed_map(): 24000 kHz
Debug: 16 21 stlink_usb.c:2542 stlink_dump_speed_map(): 8000 kHz
Debug: 17 21 stlink_usb.c:2542 stlink_dump_speed_map(): 3300 kHz
Debug: 18 21 stlink_usb.c:2542 stlink_dump_speed_map(): 1000 kHz
Debug: 19 21 stlink_usb.c:2542 stlink_dump_speed_map(): 200 kHz
Debug: 20 21 stlink_usb.c:2542 stlink_dump_speed_map(): 50 kHz
Debug: 21 21 stlink_usb.c:2542 stlink_dump_speed_map(): 5 kHz
Debug: 22 26 stlink_usb.c:1378 stlink_usb_init_mode(): MODE: 0x02
Debug: 23 28 stlink_usb.c:2874 stlink_usb_open(): Using TAR autoincrement: 4096
Info : 24 28 main.c:209 main(): target have 32Kb ram
Debug: 25 526269 stlink_usb.c:500 jtag_libusb_bulk_transfer_n(): ERROR, transfer 1 failed, error -7
I am using master branch openocd:
Open On-Chip Debugger 0.10.0+dev-00957-g9de7d9c8 (2019-11-15-13:16)
I checked stlink 2.1 and here everytning is OK
Tested on ST-Link V3 with latest FW from ST website
Reading 255 byte or less works.
Reading 256 bytes makes ST-Link hang. I need to disconnect it from my PC to get it working again
Can you please check if it is the same on your side?
A quick and dirty workaround seams to change in src/jtag/drivers/stlink_usb.c the macro STLINKV3_MAX_RW8 from current 512 to 128.
I will check further ...
In my case it fails at 256
I also have to disconnect stlink.
for (size_t i = 0; i < 1024; i++)
{
res = api->read_mem(handle, RAM_START, 1, i, buf);
if (res < 0)
{
LOG_ERROR("fail at %d with error %d", i, res);
break;
}
}
Debug: 25 2404 stlink_usb.c:500 jtag_libusb_bulk_transfer_n(): ERROR, transfer 1 failed, error -7
Error: 26 2404 main.c:227 main(): fail at 256 with error -4
The issue has been fixed by ST in STLink FW version 2.36.26 (v3j6) published today in
https://my.st.com/content/my_st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-link007.html
The patch in gerrit
http://openocd.zylin.com/5408
applyes a workaround for old FW and uses the max size on new FW only.
If you can, please provide feedbacks here or in gerrit
Looks ok for me.
I compiled my previous sources with STLINKV3_MAX_RW8 equal 255 and I think I stay with my fork as in openocd master I see now DAP interface, but I dont have a time at the moment to see what it means for my project.
Thank you Antonio.