完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
微控制器:stm8s003f3p6
当我尝试上传代码时,它显示以下错误 错误:无法与设备通信! 因此我认为显示此错误是因为未配置内部振荡器。 然后我在STVD中使用了以下内部时钟配置,但它显示错误跟随错误 void InitialiseSystemClock() { CLK_ICKR = 0; //重置内部时钟寄存器。 CLK_ICKR_HSIEN = 1; //启用HSI。 CLK_ECKR = 0; //禁用外部时钟。 while(CLK_ICKR_HSIRDY == 0); //等待HSI准备好使用。 CLK_CKDIVR = 0; //确保时钟全速运行。 CLK_PCKENR1 = 0xff; //启用所有外设时钟。 CLK_PCKENR2 = 0xff; //同上 CLK_CCOR = 0; //关闭CCO。 CLK_HSITRIMR = 0; //关闭任何HSIU修剪。 CLK_SWIMCCR = 0; //将SWIM设置为以时钟/ 2运行。 CLK_SWR = 0xe1; //使用HSI作为时钟源。 CLK_SWCR = 0; //复位时钟切换控制寄存器。 CLK_SWCR_SWEN = 1; //启用切换。 while(CLK_SWCR_SWBSY!= 0); //时钟开关忙时暂停 }& sharperror cpstm8 main.c:13(17)无效左值 & sharperror cpstm8 main.c:22(16)无效左值 & sharperror cpstm8 main.c:21(0 + 8)CLK_SWCR undefined & sharperror cpstm8 main.c:20(0 + 7)CLK_SWR未定义 & sharperror cpstm8 main.c:19(0 + 11)CLK_SWIMCCR undefined & sharperror cpstm8 main.c:18(0 + 12)CLK_HSITRIMR未定义 & sharperror cpstm8 main.c:17(0 + 11)CLK_PCKENR2 undefined & sharperror cpstm8 main.c:16(0 + 11)CLK_PCKENR1未定义 & sharperror cpstm8 main.c:15(0 + 10)CLK_CKDIVR未定义 & sharperror cpstm8 main.c:14(0 + 8)CLK_ECKR未定义 & sharperror cpstm8 main.c:12(0 + 8)CLK_ICKR未定义 & sharperror cpstm8 main.c:41(7)缺少原型 #stvd#internal-oscillator#stm8 以上来自于谷歌翻译 以下为原文 microcontroller :stm8s003f3p6 when I am trying to upload the code it shows following error Error : Cannot communicate with the device ! so I was thinking this error is shown because the internal oscillator is not configured. then I have used following internal clock configuration in STVD but it is showing error following error void InitialiseSystemClock() { CLK_ICKR = 0; // Reset the Internal Clock Register. CLK_ICKR_HSIEN = 1; // Enable the HSI. CLK_ECKR = 0; // Disable the external clock. while (CLK_ICKR_HSIRDY == 0); // Wait for the HSI to be ready for use. CLK_CKDIVR = 0; // Ensure the clocks are running at full speed. CLK_PCKENR1 = 0xff; // Enable all peripheral clocks. CLK_PCKENR2 = 0xff; // Ditto. CLK_CCOR = 0; // Turn off CCO. CLK_HSITRIMR = 0; // Turn off any HSIU trimming. CLK_SWIMCCR = 0; // Set SWIM to run at clock / 2. CLK_SWR = 0xe1; // Use HSI as the clock source. CLK_SWCR = 0; // Reset the clock switch control register. CLK_SWCR_SWEN = 1; // Enable switching. while (CLK_SWCR_SWBSY != 0); // Pause while the clock switch is busy. }&sharperror cpstm8 main.c:13(17) invalid lvalue &sharperror cpstm8 main.c:22(16) invalid lvalue &sharperror cpstm8 main.c:21(0+8) CLK_SWCR undefined &sharperror cpstm8 main.c:20(0+7) CLK_SWR undefined &sharperror cpstm8 main.c:19(0+11) CLK_SWIMCCR undefined &sharperror cpstm8 main.c:18(0+12) CLK_HSITRIMR undefined &sharperror cpstm8 main.c:17(0+11) CLK_PCKENR2 undefined &sharperror cpstm8 main.c:16(0+11) CLK_PCKENR1 undefined &sharperror cpstm8 main.c:15(0+10) CLK_CKDIVR undefined &sharperror cpstm8 main.c:14(0+8) CLK_ECKR undefined &sharperror cpstm8 main.c:12(0+8) CLK_ICKR undefined &sharperror cpstm8 main.c:41(7) missing prototype #stvd #internal-oscillator #stm8 |
|
相关推荐
1个回答
|
|
你好,
假设你正在使用ST-link v2,你是否正确连接,是否安装了驱动程序,STVD配置使用它等? 第二个错误是因为没有定义CLK_SWR(和其他)。各自的寄存器地址未知。这些应该在编译器的头文件中提供。 此外,默认情况下启用HSI时钟。 谢谢, 伊恩 以上来自于谷歌翻译 以下为原文 Hello, Presuming you are using an ST-link v2, have you got it connected correctly, are the drivers installed, is STVD configured to use it etc? The second error is because CLK_SWR (and the others) are not defined. The respective register address is unknown. These should be available in a header file from your compiler. Also the HSI clock is enabled by default. Thanks, Ian |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2742 浏览 1 评论
3244 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1813 浏览 1 评论
3653 浏览 6 评论
6044 浏览 21 评论
1342浏览 4评论
203浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
356浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
446浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
275浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 18:30 , Processed in 1.607613 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号