cancel
Showing results for 
Search instead for 
Did you mean: 

Access violation on connectUsartBootloader(uartParam[2]) using CubeProgrammer_Api.dll

RYang.1320
Associate

Hi

This is my first post on this Community. I am not sure I am getting in the right place for questions. If this is a wrong one, please let me know where I can find for help.

I am working on my own console project with VS2019 Community VC++. I have followed the example "STM32CubePrgApi" to have all settings done on my console project. I could compile it without error. But, when I ran it with debug on, I ran in to an exception

"Exception thrown at 0x0000000000000000 in MCP2221Demo.exe 0xC0000005:

Access violation executing location 0x0000000000000000."

This exception looks like a NULL exception to me. The code I was getting this exception is

"int uartConnectFlag = connectUsartBootloader(uartParam[2]);"

I peeked uartParam[2] and got uartParam[2].portName = "COM6". This meant that there was a serial port COM6 but was not allowed to access.

By the way, with same codes above, I could run nicely on "STM32CubePrgApi" example.

General project settings for both projects are

  1. Windows SDK version​ : 10.0.19041.0
  2. Platform toolset : Visual Studio 2019(v142)
  3. Platform: x64

Does any one can help?

Thanks

Rick

1 REPLY 1
qq.1
Associate

I got Segmentation Fault on "connectUsartBootloader" - I think it's somehow connected to your problem.

EDIT:

Found solution. In my case the problem was caused by removing DisplayManger.cpp from the project. It seems the display callbacks MUST be set to anything else than NULL, otherwise I always get seg fault.

vsLogMsg.logMessage = DisplayMessage;
vsLogMsg.initProgressBar = InitPBar;
vsLogMsg.loadBar = lBar;
setDisplayCallbacks(vsLogMsg);