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

Pulse, timer and UART with GPIOTE and PPI

Hello,

My problem statement is something like this:

    • Implement a Transmit Enable (TxEn) on a GPIO pin.
    • TxEn should be initialized low.
    • TxEn should be pulled high 30us before the first start bit transmission begins.
    • TxEn should remain high during serial transmission of multiple bytes.
    • TxEn should be pulled low 60us after the last stop is transmitted.
    • TxEn handling and serial transmission should not substantially block main program execution.

I figured I need to use the GPIOTE and PPI functionality. 

My question is that since I have 3 functions to take care of: GPIO transition, timer compare and UART start/stop, how best can I utilize GPIOTE and PPI to accomplish this.

Option 1: Event - GPIO low to high, Task- timer compare and then start UART

Option 2: Set GPIO high,  Event - Timer compare, Task- UART start

What approach should I follow? Is there another option,  is there a way to use all 3 in a GPIOTE-PPI combination?

Thanks

Parents Reply
  • TimerCC_event --> PPI -->UART_START

    UART_ENDTX _event--> PPI --> Timer_start

    These two connections seem necessary.

    But the main challenge is that if you have only one timer, then you need to reconfigure the CC from 30us to 60us. And it is difficult to do it exactly when last byte is transmitted (if UART_ENDTX event generates interrupt that is with highest priority, then you can do it). But if you have two timers to spare, then you can easily do it.

    Good luck with it, let me know if you have some challenges, it seems interesting.

Children
Related