In my project (STM32F407, MDK-ARM4.54) I cannot change the values of peripheral registers in the watch window. The values are displayed correctly, but I cannot change them. (e. g. ADC1->JSQR - channel selection register of ADC1). Possibly it is due to the variable range (0x40000000 compared to 0x2000000)? The normal variables work well now, also the static members of classes, thank you very much.
I tried to open the system viewer to have a look at the ADC1 module there, but the system viewer sub-menu in MDK-ARM4.54 is displayed empty (not any sub-entries) - in earlier versions I think I could have a look at the controller modules there.
PS: It is not ultimately required for me, to change values of peripheral registers in the watch window, I can live with MDK 4.54 well - just it would be helpful, if this would work.
Great, works perfectly - there I now also can change the peripheral register values.
Thank you for the fast response.
no problem, you're welcome. Also thanks for your reply.
> I cannot change the values of peripheral registers in the watch window. The values are > displayed correctly, but I cannot change them. (e. g. ADC1->JSQR - channel selection > register of ADC1).
Hi,
I've tried on an MCBSTM32F200 with ADC1, and I can change the value of JSQR in Memory, Watch and System Viewer. When sending the Register to watch, the whole expression must be selected, then right click and sent to watch: ADC3->JSQR
it will expand to this in the watch window: ((ADC_TypeDef *) ((((uint32_t)0x40000000) + 0x00010000) + 0x2200))->JSQR
. BR, /th.
Thank you for this hint, how to fast add something to the watch window - I did not know the right mouse popup for this ... (I always double clicked over "<Enter expression>" in the watch window (or over some other watch variable which I did not need any more), and then I would have entered e. g. ADC1->JSQR).
But the situation keeps the same either way: I see the current value of this register, but I cannot modify it (I can modify it in the edit field in the column "Value", but as soon as I press enter, the value jumps back to the original value).
With my program variables all works without any problem.
(I use the ST4-Discovery board with the new ST-Link Debugger (NOT the "deprecated version")).
Does the ADC1 have clock enabled and is accessible?
Yes, of course, ADC1 is working nicely now, and I still cannot change such registers (also in some breakpoint after ADC1 initialize is complete).
[I just also tried your original Keil Blinky Example C:\Keil\ARM\Boards\Keil\MCBSTM32F400\Blinky on the board MCBSTM32F400 (with Ulink-ME), and there I have the same problem - also after I insert the line RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; at the beginning of main.c - if I set the breakpoint after ADC1 enabled. ]
But it is really no severe problem for me, as I can modify the values in the system viewer.
During the weekend I worked at home with uVision 4.53 - there I recognized that the problem existed already in uVision 4.53 (same behaviour) - I did not recognize it earlier. (Just now, when testing the new watch window ... I knew this problem previously from static variables ... so it is a problem which I recognize immediately).
thanks for your reply.
I faked a ADC1_Init (derived from ADC_Init initializing ADC3) from the Blinky_ULp example and tested the issue with ULINK pro and ULINK ME, and on both I was able to change the content of ADC1->JSQR (which I took as reference) from Watch Window and System Viewer.
void ADC1_Init (void) { /* Setup potentiometer pin PF9 and A/D converter ADC3 */ RCC->APB2ENR |= (1UL << 8); /* Enable ADC3 clock */ RCC->AHB1ENR |= (1UL << 5); /* Enable GPIOF clock */ GPIOF->MODER |= (3UL << 2*9); /* PF9 is Analog mode */ ADC1->SQR1 = 0; ADC1->SQR2 = 0; ADC1->SQR3 = (7UL << 0); /* SQ1 = channel 7 */ ADC1->SMPR1 = (7UL << 6); /* Channel 12 sample time is 480 cyc. */ ADC1->SMPR2 = 0; /* Clear register */ ADC1->CR1 = (1UL << 8); /* Scan mode on */ ADC1->CR2 |= ( 1UL << 3); /* Initialize calibration registers */ while (ADC1->CR2 & (1UL << 3)); /* Wait for initialization to finish */ ADC1->CR2 |= ( 1UL << 2); /* Start calibration */ while (ADC1->CR2 & (1UL << 2)); /* Wait for calibration to finish */ ADC1->CR1 |= ( 1UL << 5); /* enable EOC interrupt */ NVIC_EnableIRQ(ADC_IRQn); /* Enable ADC Interrupt */ ADC1->CR2 |= ( 1UL << 0); /* ADC enable */ ADC1->JSQR; }
Could you please raise a support request and attach an example to reproduce the problem? Thank you!
Are you sure that you really understood my problem?
I enter ADC1 in the watch window. Then I press the + to open the members. Then at JSQR it will show the current value correctly (if I do it like I described for the Blinky example, then the value will be just zero). If I change this value to e. g. "5", I can do this, but as soon I press Enter, it switches back to the init value (zero in the Blinky example above).
I tried the service support already 2 times, but both times the answer time was several weeks, and then just some poeple told me, that they did not understand my question, so please understand that I am not so eager to raise further support issues.
... but anyway this problem is not severe for me, as I could change the variable with system viewer, this is ok for me. (my other current post concerning BSV/BCV usage / saturated addition/subtraction with long long (or usage of inline assembly for STM32F4) is bringing MUCH more headache to me ... I hope that somebody might find some solution there, otherwise I might be forced to switch to some other compiler).
> I enter ADC1 in the watch window. Then I press the + to open the members. > Then at JSQR it will show the current value correctly (if I do it like I > described for the Blinky example, then the value will be just zero). > If I change this value to e. g. "5", I can do this, but as soon I press > Enter, it switches back to the init value (zero in the Blinky example > above).
Sorry, I over read that you enter the "ADC1" manually, this seems to be the point. Can you please try and mouse right click on "ADC1", Send to Watch1 ?
I also tried this already.
I also tried to enter ADC1->JSQR in the watch window already.
Further I tried already to send ADC1->JSQR to the watch window ... .
Did you try already to enter ADC1 manually in the watch window? Either of these methods should work any way - and on my system none is working.
> Did you try already to enter ADC1 manually in the watch window? yes, I did and now (see my prev. posting) I see the problem.
> Either of these methods should work any way - and on my system none is working.
whoops ... I can see that the "manually entered" version is not running correctly, the others do work and that's why I could not see the problem in the first place.
We will have a closer look what happens there, and keep you informed.
Thanks for reporting!
ok - shame over me, you are right, I just tested again in my Blinky:
If you use right mouse key and "Add 'ADC1' to..." -> "Watch1", then it really works (it shows this address "((ADC_TypeDef *) ((((uint32_t)0x40000000) + 0x00010000) + 0x2000))" in the Name column of the watch window).
Only if you enter "ADC1" manually, then it will show only the values, but the value change fails.
Thanks for the info, now we have the same behavior reproducible on both sides :-) We'll work on this!