I'm looking for a way to enable the pull down resistor on a Freescale iMX6 MCU.
I'm running a Linux distribution on it and usually interact with the hardware using a higher-level language, so I'm not 100% familiar with the stuff below.
From what I read in the i.MX50 Applications Processor Reference Manual, resistor pull up / down options are configured using pad control settings, in particular using the following functions
- PULL_KEEP_CTL (4 bits pull up/down and keeper controls)
- PUS (2 bits pull up/down configuration value)
- PUE (1 bit pull/keep select)
- PKE (1 bit enable/disable pull up, pull down or keeper capability)
I found the pin definition in arch/arm/plat-mxc/include/mach/iomux-mx6q.h
I found the definition of the pin I'm interested in (it's for this pin where I want to enable the pull down resistor).
#define _MX6Q_PAD_DISP0_DAT10__GPIO_4_31 IOMUX_PAD(0x04AC, 0x0198, 5, 0x0000, 0, 0)
The IOMUX_PAD definition contains the following
#define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _sel_input_ofs, _sel_input, _pad_ctrl) \
- _pad_ctrl_ofs – hexadecimal offset of the control register, which selects the electrical circuitry (from page 2336 in IMX35RM.pdf)
- _mux_ctrl_ofs – hexadecimal offset of the MUX control register, which selects the function of the pin
- _mux_mode – bits 2..0 in MUX control register
- _select_input_ofs – SELECT_INPUT register offset (see table 4-11 IOMUX_CTL Register Addresses from 0x07A8, IMX35RM.pdf)
- _select_input – see table 4-12 Daisy Chain List, IMX35RM.pdf
- _pad_ctrl – bits to be set in register _pad_ctrl_ofs for configuration selection
I'm wondering if changing the _pad_ctrl
value would do the trick.
Would changing the definition of the pin, rebuilding the kernel and restarting the module with the new kernel enable the pull down resistor ?
#define _MX6Q_PAD_DISP0_DAT10__GPIO_4_31 IOMUX_PAD(0x04AC, 0x0198, 5, 0x0000, 0, (PAD_CTL_PUS_100K_DOWN | PAD_CTL_PUE | PAD_CTL_PKE))
Are there other ways to change the pad control values without rebuilding a kernel and restarting the module ?
Best Answer
Check if you can access /dev/mem which gives you access to your entire ram and use mmap to access the memory-mapped I/O registers you need. I did this on a Beaglebone Black. Here is an example of accessing low-level register on a Beaglebone Black, maybe this can give you a hint. Hope it helps!