This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PWM Decoder->Waveform generation stops after 1 - 2 seconds

i'm using the sdk only for ble serial data transfer, which i'm not using for this pwm test

all code talks directly to the hw registers

those are some code snippets to show the setup

init funct :

PSEL_OUT [0] = 11 // port bit 11
PSEL_OUT [1] = 0
PSEL_OUT [2] = 0
PSEL_OUT [3] = 0

ENABLE = 1
COUNTER_TOP = 0x03ff // not needed for wafeform
MODE = PWM_MODE_UPDOWN_Up
PRESCALER = div // div = 5, divide by 32
LOOP = PWM_LOOP_CNT_Disabled
DECODER = PWM_DECODER_LOAD_WaveForm |
PWM_DECODER_MODE_RefreshCount << PWM_DECODER_MODE_Pos

pwm data struct and values :

typedef struct { /* easy-dma cfg */
ushort Dat0 ; /* pwm 0 */
ushort Dat1 ; /* pwm 1 */
ushort Dat2 ; /* pwm 2 */
ushort Dat3 ; /* pwm 3, freq */
} PACKED Data_t ;

union { /* some previous data member causes mis-alignment */
ushort Align ;
Data_t Data ;
} ;

Dat0 = 15000 >> div // prescale div = 5
Dat1 = 0
Dat1 = 0
Dat3 = 50000 >> div

pwm run funct :

void TPwm::Run (eSeq_t seq) const
{
PWM_SEQ_Type *ps = &pDev->SEQ [seq] ;
ps->PTR = (uint32_t) &Data ;
ps->CNT = sizeof (Data) / sizeof (ushort) ;
ps->REFRESH = 0 ;
ps->ENDDELAY = 0 ;

pDev->TASKS_SEQSTART [seq] = 1 ;
}

what am i missing ???

i want the ability to update pwm waveform by updating the Data_t values and calling Pwm.Run (seq) at any time i need to

for the test i call it once and it displays the proper waveform for about 1 - 2 seconds and stops until i call it again and again via input monitor cmds

thanks and cheers efiLabs

Related