Calling a function break execution, but not in debug
Hi
I have a running setup of SW4STM32 (latest software on a Ubuntu 16.04 machine) and my project, imported from CubeMX, works and debug without problem.
Only thing I can’t solve is to proper program the chip and let it start the execution of the firmware at power on.
Afret a power cycle the main program doesn’t start until I program again. I tried to progrram the generated bin with ST-Link Utility, but the result doesn’t change.
I read about similar problems, but none of the proposed solution worked for me.
Can someone help me in finding the correct configuration for a “Release” version?
Thanks.
EDIT:
Sorry for editing the thread title, but I figure out that the problem is not related to the process of importing a CubeMX project.
I started from scratch with a new project without re-add the logic function (only a blinking led is left).
In this state the board correctly start at power on and the led blinks.
When I add my code again, I found that calling a LCD init function broke the execution. Commenting it out solve the problem. Nothing particular happens in this function:
void TM_HD44780_Init(uint8_t cols, uint8_t rows) {
/* Initialize delay */
//TM_DELAY_Init();
/* Init pinout */
TM_HD44780_InitPins();
/* At least 40ms */
HD44780_Delay(45000);
/* Set LCD width and height */
HD44780_Opts.Rows = rows;
HD44780_Opts.Cols = cols;
/* Set cursor pointer to beginning for LCD */
HD44780_Opts.currentX = 0;
HD44780_Opts.currentY = 0;
HD44780_Opts.DisplayFunction = HD44780_4BITMODE | HD44780_5x8DOTS | HD44780_1LINE;
if (rows > 1) {
HD44780_Opts.DisplayFunction |= HD44780_2LINE;
}
/* Try to set 4bit mode */
TM_HD44780_Cmd4bit(0x03);
HD44780_Delay(4500);
/* Second try */
TM_HD44780_Cmd4bit(0x03);
HD44780_Delay(4500);
/* Third goo! */
TM_HD44780_Cmd4bit(0x03);
HD44780_Delay(4500);
/* Set 4-bit interface */
TM_HD44780_Cmd4bit(0x02);
HD44780_Delay(100);
/* Set # lines, font size, etc. */
TM_HD44780_Cmd(HD44780_FUNCTIONSET | HD44780_Opts.DisplayFunction);
/* Turn the display on with no cursor or blinking default */
HD44780_Opts.DisplayControl = HD44780_DISPLAYON;
TM_HD44780_DisplayOn();
/* Clear lcd */
TM_HD44780_Clear();
/* Default font directions */
HD44780_Opts.DisplayMode = HD44780_ENTRYLEFT | HD44780_ENTRYSHIFTDECREMENT;
TM_HD44780_Cmd(HD44780_ENTRYMODESET | HD44780_Opts.DisplayMode);
/* Delay */
HD44780_Delay(4500);
}
I only commented the TM_DELAY_Init() call ancd changed the delay code to reflect my needs.
Can someone explain me why this happens?
Thanks