- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My application assigns puart_tx to GPIO_PIN_P0 and puart_rx to GPIO_PIN_P2 using puart_selectUartPads(). Both of these pins are connected to an external MCU. To conserve power, this MCU needs to be turned off while its still attached to the port pins. To avoid contention on these port pins when the MCU is off I need to be able to reassign these pins back to GPIO configured as inputs prior to turning the MCU off.
How can I reassign these port pins back to GPIO? I'm assuming there is more too it than just simply calling gpio_configurePin() for each pin. The documentation is not clear at all on how pins get mapped back and forth between the UART and GPIO.
How do I disable the UART prior to reassigning its port pins to GPIO so that the reassignment does not trigger a glitch on puart_rx and thus make the UART think it received a byte when it did not?
Prior to turning the external MCU back on, I need to reassign the pins back to the UART and re-enable the UART. How can I accomplish this?
Solved! Go to Solution.
- Labels:
-
GPIO
-
Peripherhal UART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi tedlogan
Sorry for the delayed reponse. Attached is the source code that toggles between UART and GPIO. We tried a firmware patch, but realised it does not solve the issue. So added the following two lines to fix the same. These are basically covering the HW pull up's.
gpio_configurePin(puart_cfg->txpin / 16, puart_cfg->txpin % 16, 0x20, 0); |
gpio_configurePin(puart_cfg->rxpin / 16, puart_cfg->rxpin % 16, 0x400, 0);
Attached is the source code of working sample. To toggle between the same the SW1 is used.
HTH
vik86