打印
[STM8]

STM8AF6226 Pin/RST持续输出7Khz方波,程序不受控!

[复制链接]
594|7
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
hzocce|  楼主 | 2019-6-26 08:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 hzocce 于 2019-6-26 09:49 编辑

1.STM8AF6226用STVP擦空后RST Pin一直未高电平;
2.但是用IAR编译以下程序后,程序一直没有运行,最简单的程序,连配置个GPIO反转都无法实现;
  也用STVP下载过,现象一样!
    个人可理解为要么程序没有配置对,要么芯片没有复位,压根就没有进入到Main函数;
    但是通过通断VCC电源的办法,用示波器探头钩住RST Pin测量,大部分时间是RST Pin一直输出一个7Khz左右的方波信号,也会出现几次高电平的情况。
   但是当出现高电平的时候,去测量已经配置的PB0,PB1 电平,依然是长期为低电平,没有按程序跑动。
   按照stsw-stm8069改来。
3.最小系统,把板子上面的其他电路都拿掉了,直接3.3V供电,VCAP有放电容,复位是0.1uF,10K电阻。

/**
  ******************************************************************************
  * @file    Project/main.c
  * @author  MCD Application Team
  * @version V2.2.0
  * @date    30-September-2014
  * @brief   Main program body
   ******************************************************************************
  * @attention
  *
  * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2>
  *
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  * You may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
  *
  *        http://www.st.com/software_license_agreement_liberty_v2
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
  ******************************************************************************
  */


/* Includes ------------------------------------------------------------------*/
#include "stm8s.h"

/* Private defines -----------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
#define LED_GPIO_PORT  (GPIOB)
#define LED_GPIO_PINS  (GPIO_PIN_0 | GPIO_PIN_1 )


void Delay(uint16_t nCount)
{
  /* Decrement nCount value */
  while (nCount != 0)
  {
    nCount--;
  }
  
  
}



void main(void)
{

  /* Initialize I/Os in Output Mode */
  GPIO_Init(LED_GPIO_PORT, (GPIO_Pin_TypeDef)LED_GPIO_PINS, GPIO_MODE_OUT_PP_LOW_FAST);

  while (1)
  {
    /* Toggles LEDs */
    GPIO_WriteReverse(LED_GPIO_PORT, (GPIO_Pin_TypeDef)LED_GPIO_PINS);
    Delay(0xFFFF);
  }
  
}

#ifdef USE_FULL_ASSERT

/**
  * @brief  Reports the name of the source file and the source line number
  *   where the assert_param error has occurred.
  * @param file: pointer to the source file name
  * @param line: assert_param error line source number
  * @retval : None
  */
void assert_failed(u8* file, u32 line)
{
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}
#endif


/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

使用特权

评论回复
沙发
蝴蝶泉2018| | 2019-6-26 09:52 | 只看该作者
建议用STVP讲默认的optionbyte 重新烧一遍试试看。另外VCAP电容要保证1uf以上

使用特权

评论回复
板凳
hzocce|  楼主 | 2019-6-26 10:30 | 只看该作者
蝴蝶泉2018 发表于 2019-6-26 09:52
建议用STVP讲默认的optionbyte 重新烧一遍试试看。另外VCAP电容要保证1uf以上

新建STM8AF6226  STVP工程的optionbyte 是全0; 烧录了,现象一样;
VCAP并了3个1UF的电容,现象依然一样;

使用特权

评论回复
地板
hzocce|  楼主 | 2019-6-27 09:33 | 只看该作者
期待大神指点~~

使用特权

评论回复
5
waveforms| | 2019-6-27 11:18 | 只看该作者
RST输出方波信号?不应该是输入端口么

使用特权

评论回复
6
hzocce|  楼主 | 2019-6-27 11:47 | 只看该作者
waveforms 发表于 2019-6-27 11:18
RST输出方波信号?不应该是输入端口么

对,一直是方波,不管拿掉有没有拿掉外围的0.1uF电容和10K电阻。。。。。

使用特权

评论回复
7
hzocce|  楼主 | 2019-6-28 14:43 | 只看该作者
浮起来~~

使用特权

评论回复
8
hzocce|  楼主 | 2019-7-3 08:22 | 只看该作者
求关注~~

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

127

主题

561

帖子

4

粉丝