2307 views|5 replies

30

Posts

0

Resources
The OP
 

STM32 assignment question [Copy link]

Please advise on STM32 value assignment #include "stm32f10x.h" int main(void) { unsigned int a0,b0,c0,a1,b1,c1,a2,b2,c2; //initial value a0=*(unsigned int *)0x40010000;//CRL b0=*(unsigned int *)0x40021018;//RCC c0=*(unsigned int *)0x40010c0c;//ODR //value to be assigned a1=(1<<(4*0)); b1= (1<<3); c1=~(1<<0); //input value *(unsigned int *)0x40010000 |= (1<<(4*0)); //CRL port configuration L *(unsigned int *)0x40021018 |= (1<<3); //RCC clock *(unsigned int *)0x40010c0c &= ~(1<<0);//ODR data //Calculated value a2=*(unsigned int *)0x40010000;//CRL b2=*(unsigned int *)0x40021018;//RCC c2=*(unsigned int *)0x40010c0c;//ODR } void SystemInit(void) { //No error} After debugging, it is found that a0b0c0 is different from the initial value in the reference manual, and a1b1c1 is the same as the planned value. a2b2c2, and finally all are 000. What is the reason?



This post is from stm32/stm8

Latest reply

void SystemInit(void) { //No error} This function is not allowed to be like this. Let's take a test. It seems to be responsible for allocating sectors.  Details Published on 2019-3-30 19:50
 

1372

Posts

2

Resources
2
 
Why not use the existing register definitions in the header file? If you really want to write your own, the pointer must be modified with the volatile keyword.
This post is from stm32/stm8
 
 

6040

Posts

204

Resources
3
 
I don't know if you are using software simulation or connecting to a development board for simulation. The software prompts that you do not have read and write permissions to the corresponding memory, so you cannot read or write the contents.
This post is from stm32/stm8
 
 

3190

Posts

0

Resources
4
 
Are some bits of the register not writable?
This post is from stm32/stm8
 
Personal signature为江山踏坏了乌骓马,为社稷拉断了宝雕弓。
 
 

1w

Posts

16

Resources
5
 
void SystemInit(void) { //No error} This function is not allowed to be like this. Let's take a test. It seems to be responsible for allocating sectors.
This post is from stm32/stm8
 
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 

30

Posts

0

Resources
6
 
ddllxxrr posted on 2019-3-30 19:50 void SystemInit(void) { //No error} This function cannot be done like this. Let's take a test. It seems to be responsible for allocating...
It's possible.
This post is from stm32/stm8
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list