2019-12-22 01:41 AM
Hi,
I bought the stm32f401 board from aliexpress.
"WeAct" print is on the back.
Seller's site do recommend the DFU method to program the board.
But, I want to use ST-Link, so I made a simple program to control gpio port. Fusing by ST-Link seems to be good, but, the gpio is not controlled.
I am familiar with STM32F10X. I did several projects using STM32F10X.
I though gpio control is simple, but not.
I am using newest SW4STM32 and ST-Link Utility.
My program is as follow:
So simple.
void main(void)
{
/* GPIOG Peripheral clock enable */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
/* Configure PG6 and PG8 in output pushpull mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_ResetBits (GPIOA, GPIO_Pin_2);
for (;;)
{
}
}
I am fusing and running program while BOOT0 pin is low.
Solved! Go to Solution.
2019-12-22 10:15 PM
Hi,
I do upack CubeF4 and compile is success!
My mistake is in ld file
estack value in ld file
My board has 64KB RAM but estack was 96KB's
Working well!!!
BR
Paul
2019-12-22 02:30 AM
Program seems to be stocked in
Default_Handler:
Infinite_Loop:
b Infinite_Loop
But, I do not enable any Interrupt.
Any interrupt is enabled in system file?
2019-12-22 04:03 AM
HardFault_Handler is occured
2019-12-22 04:48 AM
Probably some incorrect settings/assumptions in SystemInit() with respect to clock, PLL or Flash wait states.
2019-12-22 10:13 AM
Make sure that you are using the right headers and libraries for the F4, not some old ones for the F1. They are not compatible at register level.
Then make sure that the memory sizes and initial stack pointer value in the linker script (file with *.ld extension) are valid for the onboard MCU.
2019-12-22 04:14 PM
Can I get a sample ld file working well?
BR
Paul
2019-12-22 04:46 PM
Unpack CubeF4, or pull from repository
STM32Cube_FW_F4_V1.24.1\Projects\STM32F401RE-Nucleo\Templates\SW4STM32\STM32F4xx-Nucleo\STM32F401VEHx_FLASH.ld
2019-12-22 10:15 PM
Hi,
I do upack CubeF4 and compile is success!
My mistake is in ld file
estack value in ld file
My board has 64KB RAM but estack was 96KB's
Working well!!!
BR
Paul