This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0G3507: Need Example to dynamically change Pin Function on MSPM0 series CPU at runtime.

Part Number: MSPM0G3507
Other Parts Discussed in Thread: MSPM0L1306

Looking for an example of how to change pin use temporarily at runtime. EG: when a pin was originally configured as a Output Pin but need to flip back and forth between input and output at runtime for a RC circuit.  I can do this with most other CPU and other SDK but could not find documentation on how to do it with the MSPM0 without RTOS.

In this application I need first to convert the and OUTPUT and drive it LOW to discharge a variable capacitor.  Then I want to convert it back to input feeding the OP AMP - (inverting input) to record how long it takes charge the capacitor.   I can do it with a external pchannel mosfet but this is easy for both the ATMEL Tiny CPU running bascom and the ESP32 running Arduino. 

I need this to work on both a MSPM0L1306 and MSPM0G3507.

I would also love a example of changing the PIN MUX config at runtime so I could switch to different input pins to feed the OpAmp1 - inverting input.  

These examples would be best if shown how to accomplish this without the RTOS.

  • Hi Joseph,

    There isn't an example for this. You would likely have to combine something like the Open Drain IO example and the OPA example. 

    When reconfiguring, you would want to clear the PC/PF bit in the IOMUX[PINCM] register, then re-enable it after driving low. In the OPA, you would have to change the NSEL configuration to disconnect it when the GPIO is driving low. It is possible to leave them both connected at the same time, but then you run the risk of contention. 

    Best Regards,
    Brandon Fisher