2005-06-26 10:35 PM
2005-06-23 01:35 AM
I use ST10F276 and Keil.
I am able to configure the PWM. PWMCON0 |= 0x0001; PWMCON1 |= 0x0001; PP0 = 0xFFFF; PW0 = 100; But I am not able to configure the XPWM.could you help me. Configuration of start up: _XPERSHARE EQU 1 _VISIBLE EQU 0 _XPEN EQU 1 XPWMCON0 |= 0x0001; XPWMCON1 |= 0x0001; XPP0 = 0xFFFF; XPW0 = 100; Thank you.2005-06-23 01:53 AM
Hello,
In order to be able to use correctly the XPWM peripheral, please check the following points : - XPWM peripheral is enabled by setting XPWMEN of XPERCON and XPEN bit in SYSCON register. - In your code, XPWMPORT register configuration is missing. Since in the ST10F27x, the XPWM module is implemented on P8.3...P8.0, when this module is enabled through the XPERCON register, the corresponding bits P8, DP8 and ODP8 are overwritten by the new XPWMPORT register (mapped on XBUS) which again allows the user to program pin P8.3...P8.0 according to the XPWM configurations. Add this line in the beginning of your code: XPWMPORT |= 0x0001; // The output signal of the PWM channel 0 is alternate output function of port 8 pin 0 - Choose also the signal polarity (Normal or Inverted):The XPWM signals are XORed with the outputs of the register XPOLAR before being driven to the port pins. This allows driving the XPWM signal directly to the port pin (XPOLAR.x=’0’) or drive the inverted XPWM signal (XPOLAR.x=’1’). Refer to the ST10F276 user's manual for more details. Regards, Najoua.2005-06-23 10:44 PM
Hello. Thank you for your help. But I haven't resolve the problem.
I would like to use the pin P8.0 as XPWM0. Here you can see my configuration. I have control it with the debuger. For information, I have no problem with the standart PWM module on the port P7. XPERCON = 0X065C BUSCON0 = 0X04BC SYSCON = 0XEOC5 XPWMPORT = 0x0001 DP8 = 0x00FF XPWMCON0 |= 0x1001 XPWMCON1 |= 0x0001 XPP0 = 0xFFFF XPW0 = 0x0100 XPOLAR = 0x0001 Best regards.2005-06-24 02:40 AM
Hello,
There is no need to write DP8 = 0x00FF, because when XPWM is enabled, the corresponding bits of P8, DP8 and ODP8 are overwritten by the register XPWMPORT. Your code is good and the XPWM is configured correctly. Could you please run your program after changing the SYSCON register value to 0x80C5 instead of 0XEOC5 and tell me if the pb is solved or no. Regards,2005-06-26 08:04 PM
Hello,
I have changed the SYSCON register value to 0x80C5, but the pb in not solved. My device is ST10F276-CAA and I have ridden in ERRATA SHEET ST10F276-Cx : 3.2 XPWM.1 - Consecutive write accesses to the XPWM module When both following conditions are met: – code is executed from IFlash AND – two (or more) consecutive write operations are executed with XPWM registers as target Then only the first write operation is performed: the others are not performed. Workaround: Add four NOP instructions between two write accesses to XPWM registers. 3.3 XBUS.3 - Corruption of XPWM register on read access If, fetching from IFlash, a write to XRAM is performed and followed immediately (two MOV instructions in sequence) by a read from a XPWM register, then the XPWM register is corrupted (spurious write) with the content of the data previously written in XRAM. Workaround: Insert a NOP instruction before all read accesses to the XPWM module. Do you think that the pb is one of this two. Thank you for your help Best regards2005-06-26 08:51 PM
Hello,
If you are executing your code from the flash, add four NOP instructions between every two write accesses to XPWM regs (XPWM1). Regards, [ This message was edited by: Najoua on 27-06-2005 09:21 ]2005-06-26 10:35 PM
Hello,
Here is the wright configuration. The pb is solved. XPWMPORT = 0x0001; XPWMCON0 |= 0x1001; XPWMCON1 |= 0x0001; _nop_(); //Bug ST10F276-CAA XPP0 = 0xFFFF; XPW0 = 0x0100; XPOLAR = 0x0000; Thank you for your help. An other question : do you know something about the date of the official commercialisation of this device ? best regards.