cancel
Showing results for 
Search instead for 
Did you mean: 

writeMemory() writes FFFFFFFF in locations I'm writing 00000000

nibble9
Associate II

I'm passing to writeMemory()

  • start address of where to write the char data
  • a pointer to char data
    • initialized to all 0's, then 16 bytes of non-zero data over it
  • char data block size = 100

After my (C++) program finishes executing, I use the Cube Programmer tool to connect to the STM32L4 to read the memory I just wrote. I'm seeing FFFFFFFF instead of 00000000. The non-zero 16 bytes of data shows as expected.

What am I missing? Thanks

8 REPLIES 8
nibble9
Associate II

But if I write back to back, it works:

    int writeMemoryFlag = writeMemory(systemInfoStartAddress,

      systemInfoBlockPtr,

      systemInfoSize);

    writeMemoryFlag = writeMemory(systemInfoStartAddress,

      systemInfoBlockPtr,

      systemInfoSize);

Yes, I'm writing the same data again. I suppose this is a bug. Where to enter this?

>>I suppose this is a bug.

When you make an actual determination perhaps write it up properly.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hint: where did writeMemory() come from? Doesn't look like a HAL/Cube generated function. And what does it actually do? You have the source, right?

writeMemory() is one of the API calls that come with the STM32 MCU. The help file is located in the install directory under ../api/doc:

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\api\doc\STM32CubeProgrammer_API.chm

I haven't used the CubeProgrammer API, so not sure I will be much help.

Generically:

  • did you check the return value from writeMemory(). I presume it is some kind of status (OK or error).
  • What programmer are you using? ST-Link? And what type (V2, V3, V3mini, etc.).
  • Is the STLink firmware the latest available?
  • Is this a custom board or a ST NUCLEO or DISCO board? Built-in STLink or external programmer?

There was no return error, however if there was, it would be too generic to be of any use:

CUBEPROGRAMMER_ERROR_WRITE_MEM (-10)

The programmer is STM32 CubeProgrammer using ST-LINK (V?). The driver was updated when the STM32L4 Nucleo board was setup (about 6 wks ago).

I can get the ST-LINK V? when I get to the office later today.

It appears it's ST-LINK V3, based on the install path:

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\Drivers\stsw-link009_v3\stlink_winusb_install.bat

The CubeProgrammer log during connect operation:

 09:56:12 : STM32CubeProgrammer API v2.11.0 | Windows-32Bits 

 09:56:12 : ST-LINK error (DEV_CONNECT_ERR)

 09:56:53 : ST-LINK SN : 066CFF504849868667105731

 09:56:53 : ST-LINK FW : V2J39M27

 09:56:53 : Board    : NUCLEO-L496ZG

The Board model from the "Target Information" window:

STM32L496xx/L4A6xx

Clarification:

A downloaded driver install file was located in my Downloads area that suggests STLINK-V2 is installed. The "readme.txt" file states:

Digitally signed USB driver for ST-Link/V2 on Windows7, Windows8 and Windows10,

32 and 64 bits.

I suppose I should run the driver install that shipped with the Cube Programmer application. Then see if that fixes my issue.

When I find some free time of course.