AnsweredAssumed Answered

Alternate function remapping, OPT bytes, and PWM2

Question asked by lopez.pedro.001 on May 24, 2012
Latest reply on May 24, 2012 by lopez.pedro.001
Hi again, i'm trying to set a pin to an alternate remapping pin, exactly i'm using TIM2 with PWM and i want channels in D2, D3 and D4. I have tried with this:

#define OPT2  0x4803 
FLASH_ProgramOptionByte(OPT2, 0x02);   
FLASH_ProgramOptionByte(OPT2+1, 0xFD);

with no luck, even I started to get problems with SWIM, it said that opt byte complement was different. Anyway using STVP I was able to remove that stuff. I was able to make it work by flashing my code and then chaning the opt byte with STVP....

Another problem is that after it works (0x02 in OPT2 register) if I read it I get the complemented value (0xFD), so i tried to read data memory positions 0x4801, 0x4802, 0x4804 and 0x4805 with no luck (none of them was 0x02).


I dont know what is wrong.

Btw, after I change OPT2 to 0x02 I start to get SWIM error messages (Error: Swim error [30007]: swim communicator error), but you can start debugging it and go step by step ... I get that error only if i press RUN or CONTINUE.

If you continue you get Error: gdi-error [40127]: flash memory not accessible while core is running.



The problem appears in line 1