I have been trying to get my grips around programming STM32. I have got a Nornir developed Dash7/sensor board (for which absolutely no documentation exists somehow...), which has a STM32L100RBT6 MCU. So I'd like to program my own software for this board.
So far I have succesfully made a project and build the firmware. At this point I am trying to flash the .hex file onto the MCU using a official ST-link v2 programmer, in combination with the ST-Link utility software (under windows 10). I am using the JTAG interface on the board.
In the ST-link utility, I can connect to the board, and read it out. I have erased the chip, and I only read zeros in the memory, for both memory pages (0x00000000 and 0x08000000).
When I try Target > Program
it however, after selecting my .hex file and hitting Start, the console tells me:
16:54:48 : Connected via JTAG.
16:54:48 : Connection mode : Normal.
16:54:48 : Debug in Low Power mode enabled.
16:54:49 : Device ID:0x416
16:54:49 : Device flash Size : 128KBytes
16:54:49 : Device family :STM32L100x8/L15xx8
16:54:52 : Memory programmed in 0s and 250ms.
But when I read out the memory, it is not programmed. It only shows me zeros on both pages (0x00000000 and 0x08000000).
When I select Target > Program & Verify
, I get a error message 'programming error @: 0x00000001' and the following console output:
16:55:39 : Connected via JTAG.
16:55:39 : Connection mode : Normal.
16:55:39 : Debug in Low Power mode enabled.
16:55:39 : Device ID:0x416
16:55:39 : Device flash Size : 128KBytes
16:55:39 : Device family :STM32L100x8/L15xx8
16:56:16 : No OnChip verification function found. Verify after programming will be performed.
16:56:17 : Programming error @: 0x00000001
My memory linker script (mem.ld) is as follows:
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 10K
/*
* Optional sections; define the origin and length to match
* the the specific requirements of your hardware. The zero
* length prevents inadvertent allocation.
*/
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}
I am stuck at this point, and have so far been unable to find any resources pointing me in the right direction. Any ideas?
0x08000000
for STM32, if the error is at0x00000001
there is a possibility that you want to flash your program to the wrong place. There is anAddress:
field in ST-Link Utility, please tell me what address is visible in that? – Bence Kaulics