2016-12-09 03:53 PM
Hi Everyone.
I have a very strange problem with a Nucleo-F091RC board. I've been playing around with a serialprogram just to print messages via the uart, just to get the first project started. I noticed as long as I was programming the board and resetting it without removing the power (USB cable) from the boardeverything worked fine. But when I removed the power (USB cable) and the reconnected the power to the boardit stopped working. With my DSO I noticed the uart TX line worked briefly, then the cpu stopped, no amountof resetting could get this app working again, I had to reprogram the cpu to get it to work.Is this some sort of sleep or stop mode thing going on?
Thanks
kvresto2016-12-09 04:59 PM
You'd need to review what the code is doing, and if there are any dependencies on clocks or GPIO banks that need enabling. The debugger can alter the state of things to suit its needs.
Use the ST-LINK Utilities to inspect the content of the Flash memory, and compare that against what should have been written there.
2016-12-09 05:51 PM
Hi Clive.
My code is simply printing hello world in a loop.
I'm not sure I understand what you are recommending I do?
Recap:
a) If I reprogram and keep power applied, all works ok.
b) If I remove power, and re-power,... board stops working.
c) Monitoring TX line via DSO, and re-power board, I see very brief activity on tx line, then nothing, all stopped. This brief activity on TX line is ONLY on the very first power re-application.
d) No amount of resetting, re powering will show any activity on TX line, until I reprogram the board.
Now loop back to the top
Thanks Clive, I'm lost on this one, how can I send you a pic from ST-LINK Utilities, target option byte?
maybe there is something there?
cheers
2016-12-09 07:02 PM
Clive here is the complete main.
int main(void)
{ HAL_Init();SystemClock_Config();
MX_GPIO_Init();
MX_SPI1_Init(); MX_USART2_UART_Init(); MX_USART3_UART_Init(); //MX_FATFS_Init();print_dbg(&huart2, ''\r\nNucleo-F091RC\r\n'');
print_dbg(&huart3, ''\r\nNucleo-F091RC\r\n'');while(1)
{ //loop_test(); HAL_Delay(500); print_dbg(&huart2, ''\r\nloop''); print_dbg(&huart3, ''\r\nloop''); }}2016-12-09 07:15 PM
Clive it doesn't matter what code it is, I've also tried it with a simple toggling of the led in the while loop.
2016-12-09 07:49 PM
Well you can attach images here via the camera icon, and paste code fragments directly.
There is likely other code running, configuring clocks and pins. If your code is simple, then dig deeper. I could build an example of 'Hello World!' to the Nucleo VCP, but I don't have a F0 build system close at hand right now.
There is the state of the BOOT0 pin, and an option for BOOT1. I doubt the pin on the Nucleo is doing odd things, and you could explain the state of the options.
2016-12-12 02:57 PM
Anyone have any ideas??
2016-12-12 07:03 PM
Like I said, you should look at the content of the flash memory, what you wrote and functioned, vs what is in there and not. Doesn't the utility provide a means of checksumming? Can you compare/verify? Worst case get the binary data to a file and FC or COMP the thing.
Make sure you have current firmware on the board (ST-LINK), and that there isn't anything weird going on with the mbed mass-storage controller interface.
2016-12-12 11:27 PM
Sure Clive, I was not sure why you asked to compare flash memory with my bin file, but here is what I found.
1) newly loaded file into cpu without disconnecting and reconnecting power, file and flash compare successfully. See pic
2) When I disconnect power, and reconnect power, then I perform a device memory with bin file compare, then it fails, flash and device memory are not the same, large chunks at the start of flash seem to have bee erased. See pics I haven't trolled through the data sheet as yet,.... do I have to, it should work straight out of the box?3 pics below, of success & failed compares.
Does this mean anything to anyone familiar with this cpu series, or perhaps programmer issue??
kvresto2016-12-13 04:42 PM
Hi Everyone, just an update, I updated STLINK firmware and that seems to have fixed it. Funny I swear that was the first thing I did when I plugged in the board for the first time, before I discovered my day was ruined. Anyway thanks again Clive One.
kvresto