本帖最后由 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****/
|