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

Regarding nRF52832 timer,ppi and gpiote tasks

Dear Team,

We are working on nRF52832 BLE MCU. SDK version = 15.0.0. SOFTDEVICE version = 6.0.0. IDE = segger embedded studio.

In our application we required software UART and we have also implemented software UART with 19200 baud-rate.

We are using TIMER1 working at 16 MHz  internal frequency. In our application, we first decided what to do with our UART transmitter pin in TIMER1 interrupt routine and  also trigger the same in interrupt routine as per the data bits.

Now our requirement is just to decide what to do with UART transmitter pin for the next compare event not for the current compare event. We have thought that this task can be accomplished using PPI concept.

Kindly tell us how to set , reset and toggle UART transmitter pin for the next compare event means we will have to decide what to do in EVENTS_COMPARE[1] in EVENTS_COMPARE[0].

So please kindly guide us for suitable solution and if possible kindly share any related example.

Regards,

Hasmukh

Parents Reply Children
  • Thanks for your quick reply,

    i want to ask that Is that possible to allocate a GPIOTE task (set,reset,toggle) for timer compare event 1 in timer compare event 0 ?

    Can you give me any suggestion for the same?

  • After thinking about it, I am not sure how well using gpiote will work, the problem is that only one gpiote task can be connected to a specific pin. So only one compare event can control a pin, and you would need to update the gpiote task (to set or clear) for each compare event.

    Maybe you can use the PWM to create UART output, I can check internally if someone may have suggestions on how to do that.

    Out of curiosity, why can't you use the UART peripheral here to create 19200 baud?

  • Thanks for your reply,

    We are using nrf52832 which has one Hardware UART. This Hardware UART is already occupied for other peripheral. 

    And we need another UART for MAX1472 RF transmitter so we go for software UART concept. We already implemented software UART code for 19200 bd. We are using internal 16 Mhz clock frequency so bit width is around 52.08 microseconds. The bit width gets changed while capturing the frames from the receiver side. So some frames are missed by the RF receiver. Our requirement is to bring maximum accuracy in bitwidth so we have thought to go for ppi task concept. 

    There is another problem in changing gpiote task. if UART TX pin is already low and our next bit is 0 means UART TX pin should be low for the next 52 microseconds and we will assign gpiote task with polarity HITOLO then nRF52832 internally make UART TX pin high for around 6 microseconds and then make it lo for around 45 microseconds. So we get 6 microsecond spikes in between the frame.

    So kindly give some guidance for the same.

    thanks

    Hasmukh

  • Do the two UART interfaces have to work simultaneously? Or can you use the same UART and switch pins? I guess you have already considered this.

    You may also consider using the nRF52840, which have 2 UART interfaces. 

    Prajapati said:
    HITOLO then nRF52832 internally make UART TX pin high for around 6 microseconds and then make it lo for around 45 microseconds

    The pin likely fall back to the GPIO configuration when re-configuring GPIOTE, so you make sure that you set GPIO to output and right level (low or high) before you change GPIOTE configuration.

Related