I have a question on coldfire MCF51JE256 on configuring alternate function for GPIO pins.
MCF51JE256 Reference Manual does not describe on how to configure it.Does anyone has sample code for configuring alternate function as KBIP(Keyboard Interrupt)
I'm pretty sure this question has been asked before in this forum, and I'm pretty sure I answered it. But I can't find that previous article, and is Forum's "Search" function keeps popping up red bars, so I can't find it.
Other chips (MCF53xx and others) have explicit registers for selecting pin functions. I assume that's what you're looking for in this manual as that's what I'm looking for too.
Table 2.1 lists the Package Pin Assignments.
At the top of that section it says:
MCF51JE256/128 uses the HCS08 style of pin muxing to be Flexis-compatible.
The pin defaults as GPIO and the alternate functions follow a priority
where ALT3 has the highest priority.
For anyone fully immersed in the history of the HCS08 would know exactly what that means. That's not me or you, so it is a "secret code" we have to crack in order to understand this part.
The "simple answer" is to read the entire Reference Manual, Data Sheet and all Errata from cover to cover and then read a selection of "prior history", meaning relevant older manuals. In this case you should read a few HCS08 and/or Flexis manuals to try and work out what the above code means.
But searching in this manual also finds ...
2.6.12 General-Purpose I/O and Peripheral Ports
When a port pin is configured as a general-purpose output or a peripheral
uses the port pin ...
When an on-chip peripheral system is controlling a pin, ...
For information about controlling these pins as general-purpose I/O pins,
see Chapter 6, “Parallel Input/Output Control.” ...
So follow the link in the above to:
Parallel Input/Output Control
Many port pins are shared with on-chip peripherals such as time systems,
communication systems, or keyboard interrupts as shown in Figure 1-1.
The peripheral modules have priority over the general-purpose I/O
functions so that when a peripheral is enabled, the I/O functions
associated with the shared pins may be disabled.
After reset, the shared peripheral functions are disabled and the pins are
configured as inputs
So it looks like you select an alternate function by enabling the relevant peripheral. If you turn all of them on then "the highest one wins".
I guess that's how the older (HCS08 and prior) parts worked as well. The designers were probably trying to save silicon and limit the number of control registers, so having this pin control be "automatic" did that and simplified the programming.
If you look at something like the ADC, there are three "APCTL" registers that define whether the GPIO pin is now only an ADC pin or whether the GPIO still works.
To enable the KBIP functions you just set the interrupt enable bits. The pins probably keep working as GPIOs as well.
Retrieving data ...