S32k146. Can't read vaule from Can register.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32k146. Can't read vaule from Can register.

857 Views
郑文豪
Contributor I

Can0.IFLAG1(Address 0x4002 4030) is 0x0000 0002 in EmbSys Registers view.1.png

Then u32flagReg reads from 0x4002 4030,the value is 0.Why are they different?Whether it is related to the optimization level?

0 Kudos
3 Replies

839 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello,

I don't know what the macro does, can you replace is with something like this:

u32flagReg = *((uint32_t*)0x40024030);

You can try using lower optimization level, I guess.

 

Regards,

Daniel

 

0 Kudos

835 Views
郑文豪
Contributor I

Same result by using u32flagReg = *((uint32_t*)0x40024030).

2.png

The optimize is O1 now.If I choose O0,the program restarts.Is there any other way?

1.png

0 Kudos

796 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

It does not seems to be an issue with the optimization, please use the default one.

The screenshots that you sent shows the variable before the register is read by the core.

Can you step the whole function without a breakpoint there? Do you see a difference when you step the code and run the code?

I see the project is complex, can you reproduce the behavior with a simple test project?

If so, please send to the project so that we can test it on our side.

 

Thank you,

Daniel

 

 

0 Kudos