yonglai888 发表于 2011-10-6 15:02:19

现有项目求大侠指点!有偿帮助!谢谢

现做了一款电路板,用的芯片STM32F100R8,现以焊好电路板,用串口可以下载程序,现在问题是晶振没有启振,程序下载后也没反应,所用的程序都是实例程序编写的,现不知道该如何处理,如果有用过此IC且熟悉编程的大侠,请联系我QQ:27235729,视情况可以有偿请教!具体情况再细聊,情况紧急!非诚勿扰!

发表于 2011-10-6 16:14:16

RE:现有项目求大侠指点!有偿帮助!谢谢

1、请确认你的工程是100芯片的
2、外部晶振要用8Mhz的。
3、你可以选择内部时钟作为时钟源,看看能不能工作。

yonglai888 发表于 2011-10-6 16:38:45

RE:现有项目求大侠指点!有偿帮助!谢谢

确认是STM32F100R8的,
外部用的是8M的,如果工作会有什么现象?

发表于 2011-10-6 17:00:55

RE:现有项目求大侠指点!有偿帮助!谢谢

看你烧的什么程序了,你可以自己写一个GPIO控制LED闪烁的实验程序。看看是不是能够正常工作。可以使用仿真器,这个是最直接有效的办法了。

yonglai888 发表于 2011-10-6 17:02:41

RE:现有项目求大侠指点!有偿帮助!谢谢

void SystemInit (void)
{
/*!< RCC system reset(for debug purpose) */
/*!< Set HSION bit */
RCC->CR |= (uint32_t)0x00000001;
/*!< Reset SW, HPRE, PPRE1, PPRE2, ADCPRE and MCO bits */
RCC->CFGR &= (uint32_t)0xF8FF0000;
/*!< Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF;
/*!< Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF;
/*!< Reset PLLSRC, PLLXTPRE, PLLMUL and USBPRE bits */
RCC->CFGR &= (uint32_t)0xFF80FFFF;
/*!< Disable all interrupts */
RCC->CIR = 0x00000000;
   
/*!< Configure the System clock frequency, HCLK, PCLK2 and PCLK1 prescalers */
/*!< Configure the Flash Latency cycles and enable prefetch buffer */
//SetSysClock();                //我屏蔽了这句晶振脚就有波形了,奇怪,但LED还是没亮
}大侠能否帮我看下原因,下面是LED的程序看是否正确,
int main(void)
{
u32 cnt = 0x000fffff;
/* System Clocks Configuration */
RCC_Configuration();
/* Configure the GPIO ports */
GPIO_Configuration();

led_status = LED1;
while (1){
    switch (led_status){
    case LED1:
      //GPIOB->BSRR = 0x1000E000;       /* turn on LD1 */
      GPIOA->BSRR = 0x00000002;      //PA1,输出高电平LED就亮,低电平就灭
      led_status = LED2;         
      break;
    case LED2:
      //GPIOB->BSRR = 0x2000D000;      /* turn on LD2 */
      GPIOA->BSRR = 0x20000000;
      led_status = LED3;
      break;
    case LED3:      
      //GPIOB->BSRR = 0x4000B000;      /* turn on LD3 */
      GPIOA->BSRR = 0x00000002;
      led_status = LED4;
      break;
    case LED4:      
      //GPIOB->BSRR = 0x80007000;      /* turn on LD4 */
      GPIOA->BSRR = 0x20000000;
      led_status = LED1;
      break;
    }
    while(cnt--);
    cnt = 0x000fffff;
}
}
void RCC_Configuration(void)
{
/* Setup the microcontroller system. Initialize the Embedded Flash Interface,
   initialize the PLL and update the SystemFrequency variable. */
SystemInit();
/* GPIOA clock enable */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
}
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* GPIOB configuration: PB12 PB13 PB14 PB15 as led controller */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//GPIO_Mode_Out_PP,GPIO_Mode_Out_OD
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
}

发表于 2011-10-7 09:28:12

RE:现有项目求大侠指点!有偿帮助!谢谢

SetSysClock();不能屏蔽,100最大是24Mhz,你把下面这句放开。不要定义为72Mhz。
SYSCLK_FREQ_24MHz

k10k10k10-19309 发表于 2011-10-7 10:10:32

RE:现有项目求大侠指点!有偿帮助!谢谢

建议把整个工程打包发上来!

yonglai888 发表于 2011-10-7 11:22:44

RE:现有项目求大侠指点!有偿帮助!谢谢

SetSysClock();屏蔽了这个反而有波形,这是什么原因呢?,如果用的是内部的HSI,晶振脚上也有输波形吗?

发表于 2011-10-7 11:43:32

RE:现有项目求大侠指点!有偿帮助!谢谢

如果使用内部晶振,外部不供电,是没有波形显示的。
页: [1]
查看完整版本: 现有项目求大侠指点!有偿帮助!谢谢