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.

Change pinmux during runtime?



Hi,

Are you able to change the pinmux registers on the fly during runtime?  That is, can you initialize them to one value (for instance selcting PWM pins) and then on some event after initialization change the pinmux to use GPIO pins instead of the PWM?

We have tried doing this, and while the register reads like the pinmux is selecting GIO, the output looks like it is still PWM.

Thanks,

Dave

  • Yes you can do this.
    The typical issue here would be forgetting to write the unlock sequence to the IOMM before attempting to change a PINMMR register.
    But that would prevent the write. If you see the write 'stick' then you probably are using the wrong field or wrong register.
  • Thanks. We are writing the unlock sequence. We've double checked the registers / pins but we'll look again.

    Thanks
  • Just to confirm, what do you mean by 'output' looks like PWM ... you see it toggling or you don't see the INPUT value in the GIO register.

    There are some input muxes that are separate than output muxes - so if the symptom has to do with using the GIO pin in INPUT mode then maybe the issue is you have the output mux correct but missed the input mux. Often the input mux is in a completely different PINMMR...
  • By output I mean the signal on the pin when I put a scope to it. It is a periodic waveform initially, and then it should switch to be a gio pin set as an output, so I would expect it to output 1 or 0 (in my case it's initialized to 0 and never gets changed to output 1). What happens though is the signal output on the scope shows the it is almost always a high signal, with about 5 us where the signal goes low at the end of each period.
  • Then that sounds like an output pinmux problem - the GIO wouldn't do that on its own.

    EDIT - and you ruled out something like a PCB short, right?

  • I'm working through ruling out the different possibilities.  The code is inherited and my guess is that it never originally worked and no one noticed before, so it is probably a coding error I haven't tracked down yet.