S32k146. Can't read vaule from Can register.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can0.IFLAG1(Address 0x4002 4030) is 0x0000 0002 in EmbSys Registers view.
Then u32flagReg reads from 0x4002 4030,the value is 0.Why are they different?Whether it is related to the optimization level?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Same result by using u32flagReg = *((uint32_t*)0x40024030).
The optimize is O1 now.If I choose O0,the program restarts.Is there any other way?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
