Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 5 months ago.
Accessing individuals pins on the chip, not the arduino/morpho pins?
How would i go about telling a specific GPIO pin, say (for example pin 23) to be an output and to toggle itself on and off every half second? I cant seem to find a way to access individual pins on the chip in this manner. I don't want to use the arduino/morpho headers, I want to use the individual pins on the chip itself.
Question relating to:
1 Answer
6 years, 5 months ago.
Internally the MCU doesn't know or care where a pin physically is, the same logical function can be on different pin numbers depending on the physical package the chip is in. For this reason pin access is normally done by the logical port names (e.g. PA_1 is the first pin in IO bank A) rather than the pin number, this way the same functions are on the same pins for all package types. Where the pin physically is then becomes the hardware engineers problem not the firmware engineers.
If you need to convert between physical pin numbers and logical pin numbers you can either look at the datasheet , page 58, the LQFP64 package or Page 61 onwards, Table 15) or you look at the board schematic here .
You can always #define the pin numbers to pin names if you want e.g.
#define pin2 PC_13
which is how the arduino header IDs are mapped to the physical pins.
What about pins that are in the data sheet that don't show up in the "PinNames.h" file? Such as PC13. Should I just include them manually in "PinNames.h"?
posted by 11 Jun 2018The other thing to look out for are other uses on those pins that may not be immediately obvious e.g. PC_13 is used for the user button.
posted by 11 Jun 2018