hi! i am trying to learn pwm module of 56f8323 in my 56f8300 demo board. i have used pwm init. bean. here the code which generated by PE: setReg( PWMA_PMFCTL, 0x0000); setReg( PWMA_PWMCM, 0x02EE); setReg( PWMA_PWMVAL0, 0x02BC); setReg( PWMA_PWMVAL1, 0x0258); setReg( PWMA_PWMVAL2, 0x01F4); setReg( PWMA_PWMVAL3, 0x0190); setReg( PWMA_PWMVAL4, 0x012C); setReg( PWMA_PWMVAL5, 0x0064); setReg( PWMA_PMDISMAP1, 0x0000); setReg( PWMA_PMDISMAP2, 0x0000); setReg( PWMA_PMDEADTM, 0x0000); setReg( PWMA_PMCCR, 0x0000); setReg( PWMA_PMCFG, 0x100E); setReg( PWMA_PMOUT, 0x8000); setReg( PWMA_PMCTL, 0x0003); setReg( PWMA_PMICCR, 0x0000); edge aligned,80khz,all independent, all faults disabled, PAD_EN and PWMEN bits 1, all polarities positive. when i downloaded the code into my DSP all leds which connected to pwm outputs shows zero(there is no light)...... i have controlled the values of the registers according to peripheral user manual. it looks okey.... what is the problem??is there any idea??? isa __________________________________ |
|
PWM problem
Started by ●July 12, 2004
Reply by ●July 12, 20042004-07-12
Apparently there is a bug in Processor Expert generated code. The command: setReg( PWMA_PMCTL, 0x0003) sets LDOK bit and enables PWM count generator. However, according to the manual, to set LDOK bit user must read this bit first, then write logic 1 to it. So in your case LDOK bit is never set, and your PWM duty cycle and value register are not actually written. To fix this problem, insert getReg (PWMA_PMCTL) code right before setReg( PWMA_PMCTL, 0x0003). I want to add two things: Once you modify Processor Expert generated code (by adding getReg () ), make sure to tell PE to preserve your changes. Go to Edit/Settings menu (Settings located right under Preferences menu). Select "Processor Expert"/"Project Options", and check "Preserve User Changes" check box. One more note: Processor Expert has several interfaces for peripherals. There is PESL interface, which will produce much more optimized code for you. To use PESL, simply click on Processor Expert tab in your project, and double click on X next PESL (to enable it). Once PESL is enabled, expand it to PWMA folder, which will contain all available commands for PWM. At this point you can drag and drop desired commands into your code. For example, your application in PESL will look like this: PESL(PWMA, PWM_SET_MODULO, 0x02EE); PESL(PWMA, PWM_SET_DEADTIME, 1); PESL(PWMA, PWM_WRITE_VALUE_REG_0, 0x02BC); PESL(PWMA, PWM_WRITE_VALUE_REG_1, 0x0258); PESL(PWMA, PWM_WRITE_VALUE_REG_2, 0x01F4); PESL(PWMA, PWM_WRITE_VALUE_REG_3, 0x0190); PESL(PWMA, PWM_WRITE_VALUE_REG_4, 0x012C); PESL(PWMA, PWM_WRITE_VALUE_REG_5, 0x0064); PESL(PWMA, PWM_WRITE_DISABLE_MAPPING_REG1, 0); PESL(PWMA, PWM_WRITE_DISABLE_MAPPING_REG2, 0); PESL(PWMA, PWM_SET_ALIGNMENT, PWM_ALIGN_EDGE); PESL(PWMA, PWM_SET_INDEPENDENT_MODE, PWM_CHANNEL_01 | PWM_CHANNEL_23 | PWM_CHANNEL_45); PESL(PWMA, PWM_DEVICE, PWM_ENABLE); PESL(PWMA, PWM_LOAD_OK, NULL); PESL(PWMA, PWM_OUTPUT_PAD, PWM_ENABLE); Leonard --- In , isa "g" <olemp_isa@y...> wrote: > hi! i am trying to learn pwm module of 56f8323 in my > 56f8300 demo board. i have used pwm init. bean. here > the code which generated by PE: > > setReg( PWMA_PMFCTL, 0x0000); > > setReg( PWMA_PWMCM, 0x02EE); > > setReg( PWMA_PWMVAL0, 0x02BC); > > setReg( PWMA_PWMVAL1, 0x0258); > > setReg( PWMA_PWMVAL2, 0x01F4); > > setReg( PWMA_PWMVAL3, 0x0190); > > setReg( PWMA_PWMVAL4, 0x012C); > > setReg( PWMA_PWMVAL5, 0x0064); > > setReg( PWMA_PMDISMAP1, 0x0000); > > setReg( PWMA_PMDISMAP2, 0x0000); > > setReg( PWMA_PMDEADTM, 0x0000); > > setReg( PWMA_PMCCR, 0x0000); > > setReg( PWMA_PMCFG, 0x100E); > > setReg( PWMA_PMOUT, 0x8000); > > setReg( PWMA_PMCTL, 0x0003); > > setReg( PWMA_PMICCR, 0x0000); > > edge aligned,80khz,all independent, all faults > disabled, PAD_EN and PWMEN bits "1", all polarities > positive. > > when i downloaded the code into my DSP all leds which > connected to pwm outputs shows zero(there is no > light)...... i have controlled the values of the > registers according to peripheral user manual. it > looks okey.... what is the problem??is there any > idea??? > isa > > > __________________________________ > |
|
Reply by ●July 12, 20042004-07-12
thanks Leonard! it is working now. i am so happy:)) i have wasted 1 week for this. (i have to more pay attention PE and manuals of DSP) isa --- help56800 <> wrote: > Apparently there is a bug in Processor Expert > generated code. The > command: setReg( PWMA_PMCTL, 0x0003) sets LDOK bit > and enables PWM > count generator. However, according to the manual, > to set LDOK bit > user must read this bit first, then write logic 1 to > it. So in your > case LDOK bit is never set, and your PWM duty cycle > and value > register are not actually written. To fix this > problem, insert getReg > (PWMA_PMCTL) code right before setReg( PWMA_PMCTL, > 0x0003). > > I want to add two things: > > Once you modify Processor Expert generated code (by > adding getReg > () ), make sure to tell PE to preserve your changes. > Go to > Edit/Settings menu (Settings located right under > Preferences menu). > Select "Processor Expert"/"Project Options", and > check "Preserve > User Changes" check box. > > One more note: Processor Expert has several > interfaces for > peripherals. There is PESL interface, which will > produce much more > optimized code for you. To use PESL, simply click on > Processor > Expert tab in your project, and double click on X > next PESL (to > enable it). Once PESL is enabled, expand it to PWMA > folder, which > will contain all available commands for PWM. At this > point you can > drag and drop desired commands into your code. For > example, your > application in PESL will look like this: > > PESL(PWMA, PWM_SET_MODULO, 0x02EE); > > PESL(PWMA, PWM_SET_DEADTIME, 1); > > PESL(PWMA, PWM_WRITE_VALUE_REG_0, 0x02BC); > PESL(PWMA, PWM_WRITE_VALUE_REG_1, 0x0258); > PESL(PWMA, PWM_WRITE_VALUE_REG_2, 0x01F4); > PESL(PWMA, PWM_WRITE_VALUE_REG_3, 0x0190); > PESL(PWMA, PWM_WRITE_VALUE_REG_4, 0x012C); > PESL(PWMA, PWM_WRITE_VALUE_REG_5, 0x0064); > PESL(PWMA, PWM_WRITE_DISABLE_MAPPING_REG1, 0); > PESL(PWMA, PWM_WRITE_DISABLE_MAPPING_REG2, 0); > > PESL(PWMA, PWM_SET_ALIGNMENT, PWM_ALIGN_EDGE); > > PESL(PWMA, PWM_SET_INDEPENDENT_MODE, PWM_CHANNEL_01 > | > PWM_CHANNEL_23 | PWM_CHANNEL_45); > > PESL(PWMA, PWM_DEVICE, PWM_ENABLE); > > PESL(PWMA, PWM_LOAD_OK, NULL); > PESL(PWMA, PWM_OUTPUT_PAD, PWM_ENABLE); > > Leonard > > --- In , isa "g" > <olemp_isa@y...> > wrote: > > hi! i am trying to learn pwm module of 56f8323 in > my > > 56f8300 demo board. i have used pwm init. bean. > here > > the code which generated by PE: > > > > setReg( PWMA_PMFCTL, 0x0000); > > > > setReg( PWMA_PWMCM, 0x02EE); > > > > setReg( PWMA_PWMVAL0, 0x02BC); > > > > setReg( PWMA_PWMVAL1, 0x0258); > > > > setReg( PWMA_PWMVAL2, 0x01F4); > > > > setReg( PWMA_PWMVAL3, 0x0190); > > > > setReg( PWMA_PWMVAL4, 0x012C); > > > > setReg( PWMA_PWMVAL5, 0x0064); > > > > setReg( PWMA_PMDISMAP1, 0x0000); > > > > setReg( PWMA_PMDISMAP2, 0x0000); > > > > setReg( PWMA_PMDEADTM, 0x0000); > > > > setReg( PWMA_PMCCR, 0x0000); > > > > setReg( PWMA_PMCFG, 0x100E); > > > > setReg( PWMA_PMOUT, 0x8000); > > > > setReg( PWMA_PMCTL, 0x0003); > > > > setReg( PWMA_PMICCR, 0x0000); > > > > edge aligned,80khz,all independent, all faults > > disabled, PAD_EN and PWMEN bits "1", all > polarities > > positive. > > > > when i downloaded the code into my DSP all leds > which > > connected to pwm outputs shows zero(there is no > > light)...... i have controlled the values of the > > registers according to peripheral user manual. it > > looks okey.... what is the problem??is there any > > idea??? > > > > > > isa > > > > > > > > > > __________________________________ > > > __________________________________ |