cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f405 strange behavior

Angelo1
Associate II
Posted on April 03, 2014 at 18:16

Dear,

i am proceeding over a development of a quiet simple application (23K of code now), increasing complexity, everything was working fine, but from some recent code improvements and builds, i started to have the application behavior corrupted. I am driving am SSD1289 lcd / touch, and driving also some gpio. Increasing the code size, LCD started to be non responsive to the graphic commands, so i commented out the great part of the code, and let only a small code working. If i just init the gpio, and make a relay click on and off each second, it works.

/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
delay_decrement();
prescaler--;
if(prescaler == 0)
{
prescaler = 200;
}
}

void delay_decrement(void) { if (time_preload != 0x00) time_preload--; } void delay_ms(volatile uint32_t t) { time_preload = t; while(time_preload != 0); }

void run ()
{
for(;;)
{
gpio_relay_on_off(i);
i=!i;
delay_ms(1000);
}
}

But, if i start to enable the FSMC controller, with the line: RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); Then i hear the relay clicking on or off each 4 seconds. Very strange. Could i have some hardware issue ? Many thanks Angelo
3 REPLIES 3
Posted on April 03, 2014 at 18:36

Could i have some hardware issue ?

Or a software one. Or one with your linker script.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Angelo1
Associate II
Posted on April 03, 2014 at 18:58

Dear Clive,

solved, seems it was another issue in the linker script, on the .data section, for the remapping flash ''.data'' to ram.

These because i am using gcc toolchain, and i found a starting linker script that i extended.

A professor at my school was saying ''ok to copy, but understanding !''. Now as a punishment i study well the linker script, i have to make it mine.

Ciao

Angelo

Posted on April 03, 2014 at 19:44

In the other thread I pointed to a project that uses GNU/GCC and has a functional linker script.

Linker Scripts (or Scatter Files, in Keil nomenclature) are complex beasts, I tend to find many examples and understand them, and adapt them as required. I have a background in linkers/loaders, and the GNU linker is far more inflexible than others that target embedded explicitly, ie split roms, or sparse memory maps.

The complexity in ROM/FLASH based systems is that the start up code must initialize and copy things to RAM (unpack itself), rather than an executable file format, which paints each memory area explicitly.

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