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

NRF52 PWM Sequence idle State

Hello,

i'am trying to control the pwm Idle State Level.

between my Sequence's (1sek) the PIN stays High But i need it low.

I try to set the GPIO Out Register, but this didn't work.

  uint32_t seq0_ram[9]= {0x80198019,0x80108010,0x80198019,0x80148014,0x80148014,0x00140014,0x00140014,0x00140014,0xFF};
  uint32_t b = NRF_GPIO->OUT;
  NRF_GPIO->OUT = (b &~0x100000);


  NRF_PWM0->PSEL.OUT[0] = (first_pin  << PWM_PSEL_OUT_PIN_Pos) |
                        (PWM_PSEL_OUT_CONNECT_Connected <<
                                                 PWM_PSEL_OUT_CONNECT_Pos);
  NRF_PWM0->ENABLE      = (PWM_ENABLE_ENABLE_Enabled << PWM_ENABLE_ENABLE_Pos);
  NRF_PWM0->MODE        = (PWM_MODE_UPDOWN_Up << PWM_MODE_UPDOWN_Pos);
  NRF_PWM0->PRESCALER   = (PWM_PRESCALER_PRESCALER_DIV_1 <<
                                                   PWM_PRESCALER_PRESCALER_Pos);
  NRF_PWM0->COUNTERTOP  = (27 << PWM_COUNTERTOP_COUNTERTOP_Pos); //1 msec
  NRF_PWM0->LOOP        = (PWM_LOOP_CNT_Disabled << PWM_LOOP_CNT_Pos);
  NRF_PWM0->DECODER   = (PWM_DECODER_LOAD_Common << PWM_DECODER_LOAD_Pos) |
                        (PWM_DECODER_MODE_RefreshCount << PWM_DECODER_MODE_Pos);
  NRF_PWM0->SEQ[0].PTR  = ((uint32_t)(seq0_ram) << PWM_SEQ_PTR_PTR_Pos);
  NRF_PWM0->SEQ[0].CNT  = ((sizeof(seq0_ram) / sizeof(uint16_t)) <<
                                                   PWM_SEQ_CNT_CNT_Pos);                                              
  NRF_PWM0->SEQ[0].REFRESH  = 0;
  NRF_PWM0->SEQ[0].ENDDELAY = 100;
  NRF_PWM0->TASKS_SEQSTART[0] = 1;

Parents Reply Children
No Data
Related