I am currently trying to make my own stm32 development board. i have stm32f100c4t6 microcontroller mounted on pcb. I am using Atollic True studio free edition. i had made small blink led program as below.
#include <stddef.h>
#include "stm32f10x.h"
void delay(int count)
{
volatile int i;
for (i = 0; i < count; i++)
{
}
}
GPIO_InitTypeDef GPIO_InitStructure;
int main(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
while (1)
{
delay(100000);
GPIOA->BSRR = 0xF << 3;
delay(100000);
GPIOA->BRR = 0xF << 3;
}
}
I have used st flash loader demonstrator under windows to load program to flash memory. however it detects the flash memory size as 32 KB whereas actually it has 16 KB. but program loaded to flash and verified successfully. (it detects device ID as 0x420 which is for medium density value line whereas this microcontroller is low-density value line.)
When i change the jumper setting of BOOT0 to ground to put it in execution mode, nothing happens. the pin PA3 to P6 remains at 0v. i have connected 24 MHz crystal as main crytal and 32.768KHz as RTC crystal. I can get voltages around 1.8v at 24 MHz crystal. the other crystal pins remains at 0v. is this wrong?
I have also tried stm32flash under linux to load program, it loads and verify the program sucessfully. but, it also detects microcontroller as mediam density value line (128 KB).
I am stuck at this situation. any help would be appreciable.
Thanks for reading.
EDIT: I have attached link of schematic.
volatile
on a variable that is not accessible from any other context (is local and its address isn't passed anywhere). I'd check the machine code that the delay loop is really there. \$\endgroup\$