Can the UART RX/TX pins be also read as GPIO input pins

Greetings,

We are using the NCS for the development of a new product with a custom board based on the nRF52840 MCU.

First, we would like to use the Serial DFU feature to update the firmware over UART. I have found and will be implementing this guide for that. Please confirm that this is indeed correct.

Second we want to also use the same lines(RX/TX) as GPIOs (inputs) and read their status. What way would you suggest going about this? I have found this suggestion usefull (connecting the TX/RX lines to two other available GPIO pins to also read the level of the TX/RX lines) as we will not be using the UART interface and reading the same lines simultaneously.

What are your thoughts and suggestions on implementing this? Will connecting two other GPIO pins on the RX/TX lines cause issues to the UART even if we do not read the pins while the UART interface is in use?

Thank you very much and I look forward to hearing from you!

Best regards,

Stavros

Parents
  • Hi Stavros, 

    Regarding your questions: 

    1. Correct. If you want to implement DFU update in your application you can follow the guide and integrate SMPSVR into your application. Note that MCUBoot also support recovery mode that you can hold a button and enter DFU mode.(CONFIG_MCUBOOT_SERIAL=y)  This way you don't need to implement anything in the application. 

    2. Currently we have the possibility to dynamically configuration a pin with dynamic pinctrl. However, as far as I know it should only be used before the peripheral has been initialized ,as you can read here . I will need to double check with our team to get back to you. 
    Otherwise you can do what you planning, to connect the pin to two other GPIO pins and then use them as input. 

  • Hi Hung,

    Thank you very much for your immediate response!

    This info is very helpful, I wil look into it!

    A followup question, is it possible to have Serial DFU as well as OTA DFU enabled at the same time?

    Regards

Reply
  • Hi Hung,

    Thank you very much for your immediate response!

    This info is very helpful, I wil look into it!

    A followup question, is it possible to have Serial DFU as well as OTA DFU enabled at the same time?

    Regards

Children
  • Hi Stavros, 

    clockis said:
    A followup question, is it possible to have Serial DFU as well as OTA DFU enabled at the same time?

    No I don't see any problem having both Serial DFU and BLE OTA DFU supported at the same time.