Programming GPIO of BeagleBone Black in C

Try checking out Derek Molloy’s channel on youtube. http://www.youtube.com/user/DerekMolloyDCU

He has posted several excellent examples.

Andy

One last question before I close this thread. I’ve been trying to understand how to program my Black by reading articles on how to program the original BeagleBone. But I’ve heard that Black has a different way of accessing the GPIO as the kernel on black is newer. How has it changed? Please post links that’d explain this change in detail.

It hasn't changed. Programming the BeagleBone White GPIO's running the 3.8 kernel and programming the BeagleBone Black GPIO's with 3.8 kernel is no different.

But the BBW ships with linux 3.2, and the BBW with 3.8. So in effect it
has changed. My question is does 3.2 work on the BBB?

Britton

With changes, 3.2 should work. Changes need to be made to support eMMC and HDMI.

Gerald

Include Power for DRAM!

Gerald於 2013年5月17日星期五UTC+8下午11時45分35秒寫道:

Yes and the PMIC reconfiguration.

Gerald

Hi Gerald,
I am porting the 3.2 kernel to the beaglebone black board and so far so good. It boots up and can do everything that I did with 3.2 on BBW.
However, since the BBB hardware has an eMMC on it, I certainly don’t want to waste this hardware and would like to use it in my 3.2 kernel. Can I simply initialise the eMMC hardware by calling the “emmc_bone_init” function at the time of kernel powering up?

The emmc_bone_init function comes with the source code of 3.2.42 in file board-am335xevm.c. Its details are given below

static struct pinmux_config mmc1_pin_mux[] = {
{“gpmc_ad7.mmc1_dat7”, OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_ad6.mmc1_dat6”, OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_ad5.mmc1_dat5”, OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_ad4.mmc1_dat4”, OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_ad3.mmc1_dat3”, OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_ad2.mmc1_dat2”, OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_ad1.mmc1_dat1”, OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_ad0.mmc1_dat0”, OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_csn1.mmc1_clk”, OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_csn2.mmc1_cmd”, OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_csn0.gpio1_29”, OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
{“gpmc_advn_ale.mmc1_sdcd”, OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
{“uart1_rxd.mmc1_sdwp”, OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{NULL, 0},
};

static void emmc_bone_init(int evm_id, int profile)
{
printk(“cape: emmc_bone_init\n”);
setup_pin_mux(mmc1_pin_mux);
am335x_mmc[1].mmc = 2;
am335x_mmc[1].caps = MMC_CAP_4_BIT_DATA;
am335x_mmc[1].nonremovable = true;
am335x_mmc[1].gpio_cd = -EINVAL;
am335x_mmc[1].gpio_wp = -EINVAL;
am335x_mmc[1].ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34; /* 3V3 /
/
mmc will be initialized when mmc0_init is called */
return;
}

Cheers,

I can’t answer that question.

Gerald