2018-04-18 05:43 AM
So I just started developing with the STM32F Discovery board and the only thing I'm facing are problems. The biggest problem is that one time I can connect to the virtual comport using RealTerm, and the other time it says its using 'Invalid Parameters' so I can never connect. I set breakpoints and in the debugger I can clearly see my code is running. So I slowed down the amount of times I'm doing operations to once per 10ms and then it started work again.
The last problems I'm facing that I can't connect to the board with Realterm when I'm creating a new variable for instance. There's nothing wrong in the syntax, it just won't connect anymore. When I make a comment of the variable, it works, when I uncomment it, it stops working. The same goes for many other things. For instance when I'm trying to free some memory I allocated earlier it doesn't let me connect whilst the code still runs.
It's so weird when I change code that doesn't give any errors and its syntax is right it makes me unable to connect (the code wasn't even called).
Another example, when I create a new function in main. Put some logic in it, like B = A + C and leave the function alone so I'm not calling it. It also doesn't let me connect to the STM32.. But when I remove the logic inside the never-called function it lets me connect.
I'm only experiencing problems with the STM32 sadly.. Anyone knows a fix which allows me to write code for the STM32 without it crashing on the USB CDC connection?
2018-04-18 08:23 AM
Hi,
first of all try to increase the heap and/or stack memory for your project.
2018-04-19 03:02 AM
Hello,
Thanks for the quick answer first of all.
Yes, I have increased the heap and stack size when I generated the code with CubeMx.
Heap is 0x2000 and Stack is 0x4000 big, might not be enough. Do you know a proper way to allocate the right amount of memory for the heap and stack size?
2018-04-19 04:51 AM
I think your Heap and Stack is very big. In my USB CDC projects I use for Heap 0x400 and for Stack 0x800.
What a IDE you're using for compiling? Some IDEs come with their own startup file and don't use the one that is generated by CubeMX. So you have to change heap and stack manually in the startup file.Have you read this:
Maybe you find some hints.
2018-04-19 04:55 AM
I'm using Eclipe as an IDE.
I will look through the doc you provided.
2018-04-24 03:27 AM
To no avail it's still not working..
Here's a link to stackoverflow for a bit more detailed description of the problem:
2018-04-24 03:49 AM
I just found something which made connection via USB not possible:
addressTable[0].type = ISU; //Just to test. Needs to be set by USB
addressTable[0].address = 1;Whenever I uncomment those lines my code 'crashes', the code is still running but I can't connect via USB CDC anymore.
It has to do with creating an array and/or setting values inside of it.