我这山寨stm32f103c8t6到底是个啥芯片
[复制链接]
前段时间买了几片stm32f103c8t6的最小系统板做实验用,买回来后发现jlink连接不上只能指定M3核心才能连上,,问卖家是个啥芯片重新打码的,,也不回,,哎没法用啊,不知道是个啥型号,网上一通搜下了各个品牌的库,最后发现APM的能用,,心想应该是这个芯片了,,然后一通实验检测外设是否对得上,,大部分功能跟手册上对得上,,实验到现在心里没底了,也不能确定是不是apm了,怪事出来了,,,用J-MEM发现这芯片居然有256K-Flash,96K-SRam,,而且跑128M频率,Flash居然可以0周期等待稳定运行,也没温度,就是晶振那一块抗干扰不行,手摸上去就跑飞,,其他正品片子,或者手上知道型号的假片子手摸上去不会跑飞,但是速度会变慢
这片子48引脚,M3核心,256K-Flash,96K-SRam,128M、Flash0等待,DAC2通道,定时器1,2,3,4,5,6,7,这到底买到了个啥
//#define SYSTEM_CLOCK_HSE HSE_VALUE
//#define SYSTEM_CLOCK_24MHz (24000000)
//#define SYSTEM_CLOCK_36MHz (36000000)
//#define SYSTEM_CLOCK_48MHz (48000000)
//#define SYSTEM_CLOCK_56MHz (56000000)
//#define SYSTEM_CLOCK_72MHz (72000000)
//#define SYSTEM_CLOCK_96MHz (96000000)
//#define SYSTEM_CLOCK_120MHz (120000000)
#define SYSTEM_CLOCK_128MHz (128000000)
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x00
#ifdef SYSTEM_CLOCK_HSE
uint32_t SystemCoreClock = SYSTEM_CLOCK_HSE;
#elif defined SYSTEM_CLOCK_24MHz
uint32_t SystemCoreClock = SYSTEM_CLOCK_24MHz;
#elif defined SYSTEM_CLOCK_36MHz
uint32_t SystemCoreClock = SYSTEM_CLOCK_36MHz;
#elif defined SYSTEM_CLOCK_48MHz
uint32_t SystemCoreClock = SYSTEM_CLOCK_48MHz;
#elif defined SYSTEM_CLOCK_56MHz
uint32_t SystemCoreClock = SYSTEM_CLOCK_56MHz;
#elif defined SYSTEM_CLOCK_72MHz
uint32_t SystemCoreClock = SYSTEM_CLOCK_72MHz;
#elif defined SYSTEM_CLOCK_96MHz
uint32_t SystemCoreClock = SYSTEM_CLOCK_96MHz;
#elif defined SYSTEM_CLOCK_120MHz
uint32_t SystemCoreClock = SYSTEM_CLOCK_120MHz;
#else
uint32_t SystemCoreClock = SYSTEM_CLOCK_128MHz;
#endif
====================================================
static void SystemClock128M(void)
{
__IO uint32_t i;
RCM->CTRL_B.HSEEN= BIT_SET;
for(i = 0; i < HSE_STARTUP_TIMEOUT; i++)
{
if(RCM->CTRL_B.HSERDYFLG)
{
break;
}
}
if(RCM->CTRL_B.HSERDYFLG)
{
/* Enable Prefetch Buffer */
FMC->CTRL1_B.PBEN = BIT_SET;
/* Flash 3 wait state */
FMC->CTRL1_B.WS = 0; //====这里也改了
/* HCLK = SYSCLK */
RCM->CFG_B.AHBPSC= 0X00;
/* PCLK2 = HCLK */
RCM->CFG_B.APB2PSC= 0;
/* PCLK1 = HCLK / 2 */
RCM->CFG_B.APB1PSC = 4;
/** PLL: HSE * 15 */
RCM->CFG_B.PLLSRCSEL = 1;
RCM->CFG_B.PLLMULCFG = 14;
/** Enable PLL */
RCM->CTRL_B.PLLEN = 1;
/** Wait PLL Ready */
while(RCM->CTRL_B.PLLRDYFLG == BIT_RESET);
/* Select PLL as system clock source */
RCM->CFG_B.SCLKSW = 2;
/* Wait till PLL is used as system clock source */
while(RCM->CFG_B.SCLKSWSTS!= 0x02);
}
}
==================================================
void TMR_Init()
{
TMR_BaseConfig_T TMR_BaseConfigStruct;
RCM_EnableAPB2PeriphClock(RCM_APB2_PERIPH_TMR1);
TMR_BaseConfigStruct.clockDivision = TMR_CLOCK_DIV_1;
TMR_BaseConfigStruct.countMode = TMR_COUNTER_MODE_UP;
TMR_BaseConfigStruct.division = 1279;
TMR_BaseConfigStruct.period = 49999;
TMR_BaseConfigStruct.repetitionCounter = 0;
TMR_ConfigTimeBase(TMR1, &TMR_BaseConfigStruct);
TMR_EnableInterrupt(TMR1, TMR_INT_UPDATE);
NVIC_EnableIRQRequest(TMR1_UP_IRQn, 0, 0);
TMR_Enable(TMR1);
}
0等待稳定运行,,逻辑分析仪测试,时间也准确
|