cancel
Showing results for 
Search instead for 
Did you mean: 

Inaccessible registers from source or with sfr

ivancolla9
Associate III
Posted on January 27, 2016 at 11:32

Good morning,

working with the universal debbuger on the dicscovery board with SPC56EL60L3, I have this error: various registers seem inaccesible to me. If I try to monitor them with SFR, I don't see the values, but ''???????'', and if I try to do an operation on one of them (reading or writing), the micro go in exception.

Modules that behave like this are, for example, CRC, ADC, LINFLEX.

For the ADC module I tried various configurations with the wizard, but nothing. 

I cannot understand why the ude cannot see them.

P. S: I reported the problem in the discussion on the STM register, because I thincked it was related to a single module (CRC), but after various trials it seems a generic problem related to a group of modules that, for some reason, I cannot access.

Thank you,

Ivan

#ude-sfr-registers-access
4 REPLIES 4
Erwan YVIN
ST Employee
Posted on January 27, 2016 at 14:43

Hello Ivan ,

you have enable some IPs by associated PCTL (cf in RM) (cf memory map to have the associated number)

/* clock gating if present.*/
SPCSetPeripheralClockMode(?????,
SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(2));

Best regards Erwan
ivancolla9
Associate III
Posted on January 28, 2016 at 15:43

Hello Erwan,

thanks for the advice. I tried your solution, but it didn't work out. I cannot understand where to find that you suggested. If I copy the function name in my project (where I generated the board code with the wizard), I cannot find the function. Following the advice has been helpful. I discovered the ME module and the fact that peripherals must be activated. I found that the device, in RUN mode, had the peripherals deactivated, as you told. I used this code:

/* Activate extern peripherals. */
UBYTE ME_MASK = 0b11111111;
ME.RUN_PC0.R = ME.RUN_PC0.R | ME_MASK;

and it works. Do you have any suggestions regarding this piece of code? Any idea on why I cannot apply your solution? Probably I misinterpreted it. Thank you, Ivan
ivancolla9
Associate III
Posted on January 29, 2016 at 11:35

I post here to add that the solution that I found have a strange problem.

If I run the code step by step using the debugger, after the code that I posted I can use the ADC0 register.

But in run mode, after the activation code, the register remains in ????? status and I go in exception.

It seems that I miss something important.

Someone have ideas?

Thanks,

Ivan

Edit:

I understood where the problem was. I missed this two lines (sorry for the bit notation):

ME.MCTL.R = 0b01000000000000000101101011110000;

ME.MCTL.R = 0b01000000000000001010010100001111;

With this, I control a transition to the RUN0 state and configuration is loaded (so ADC converter is activated). First write: mode selection + key. Second write: mode selection + inverted key. See RM for Mode Control Register (ME_MCTL).

The problem didn't arise when I was debugging, beacuse stopping the execution on a break point commanded automaticcaly a transition from DRUN to RUN0 mode loading the config.

But if I didn't stop the application, the status of the system remained in DRUN and so my configuration were not loaded.

Regards,

Ivan

Erwan YVIN
ST Employee
Posted on February 01, 2016 at 09:40

Hello Ivan ,

Good that you find your issue ..

not easy to find , but often the solution is in the RM;-)

  Best regards

             Erwan