How to move USR functionality?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
User avatar
dbc
Posts: 89
Joined: Fri Aug 28, 2015 11:02 pm
Location: Sunnyvale, CA

How to move USR functionality?

Post by dbc » Sun Sep 06, 2015 3:29 pm

In order to get access to both timer 2 and timer 5 for QEI mode, it would be convenient to move the USR switch to some other pin. As it is, it is possible to use timer2 QEI on pins X6 and X17, but of course the encoder has a 50/50 chance of stopping with X17 driven low, so the next reboot will put the Pyboard into safe mode. This is clearly not the path to joy and happiness.

Somehow, I think at least part of the answer to my question is found in or near the directory: boards/PYBV10 -- can I get a clue as to how to point the firmware at some other pin for USR? I can wire another switch externally and the current switch can simply be ignored.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: How to move USR functionality?

Post by dhylands » Sun Sep 06, 2015 4:22 pm

To move the USR functionality to another pin, you should change 2 files:

1 - stmhal/boards/PYBV10/pins.csv - change the definition of SW - this step isn't strictly required
2 - stmhal/boards/PYBV10/mpconfigboard.h - change the definition of MICROPY_HW_USRSW_PIN

Post Reply