This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Direct connection of NAND Flash to BeagleBone

I am trying to connect NAND Flash to BeagleBone without daugter board.  I connect flash to gpmc, but linux and u-boot doesn't see flash. 

I chandged linux kernel arch/arm/mach-omap2/board-am335xevm.c:

/* Make some additions to configs */
/* Beaglebone Rev A3 and after */
static struct evm_dev_cfg beaglebone_dev_cfg[] = {
 {tps65217_init, DEV_ON_BASEBOARD, PROFILE_NONE},
 {mii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
 {usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
 {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
 {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
 {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
 {ehrpwm_init,   DEV_ON_BASEBOARD, PROFILE_NONE},
 {uart1_init,    DEV_ON_BASEBOARD, PROFILE_NONE},
 {gpio_led_init, DEV_ON_BASEBOARD, PROFILE_NONE},
 {evm_nand_init, DEV_ON_BASEBOARD, PROFILE_NONE},
 {NULL, 0, 0},
};

and u-boot board/ti/am335x/muc.c

static struct evm_pin_mux beaglebone_pin_mux[] = { {uart0_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD}, {i2c1_pin_mux, PROFILE_ALL & ~PROFILE_2 & ~PROFILE_4, DEV_ON_BASEBOARD}, //#ifdef CONFIG_NAND {nand_pin_mux, PROFILE_ALL /*& ~PROFILE_2 & ~PROFILE_3*/, DEV_ON_BASEBOARD}, //#endif #ifndef CONFIG_NO_ETH {mii1_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD}, #endif #ifdef CONFIG_MMC {mmc0_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD}, //{mmc1_pin_mux, PROFILE_ALL, DEV_ON_BASEBOARD}, /* Иначе инициал. перекрывает пины NAND */ #endif #ifdef CONFIG_SPI {spi0_pin_mux, PROFILE_2, DEV_ON_DGHTR_BRD}, #endif {0}, };

now u-boot and linux 'see' nand flash. But when i try to read data from flash error occurs...
u-boot writes some think like than:
when boot:
"Error: Bad compare! failed"
or when i try to read data
"NAND read from offset 260000 failed -74"

in Linux always writes ECC: correction... whats wrong?!


  • Hi there:

    You need to check your flash is 16bit or 8bit address. you need to set the GPMC according, also the pin mux need to set to support 16bit address (it is 8-bit for the existing code)

    This is my setting for board_am335xevm.c. You also need it in the u-boot.

     /* Pin mux for nand flash module */
    static struct pinmux_config nand_pin_mux[] = {
     {"gpmc_ad0.gpmc_ad0",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad1.gpmc_ad1",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad2.gpmc_ad2",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad3.gpmc_ad3",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad4.gpmc_ad4",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad5.gpmc_ad5",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad6.gpmc_ad6",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad7.gpmc_ad7",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
    #ifdef CONFIG_OMAP3_BEAGLE_NAND /* beagle nand flash is 16bit */
     {"gpmc_ad8.gpmc_ad8",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad9.gpmc_ad9",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad10.gpmc_ad10",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad11.gpmc_ad11",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad12.gpmc_ad12",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad13.gpmc_ad13",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad14.gpmc_ad14",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_ad15.gpmc_ad15",   OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
    #endif
     {"gpmc_wait0.gpmc_wait0", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_wpn.gpmc_wpn",   OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
     {"gpmc_csn0.gpmc_csn0",   OMAP_MUX_MODE0 | AM33XX_PULL_DISA},
     {"gpmc_advn_ale.gpmc_advn_ale",  OMAP_MUX_MODE0 | AM33XX_PULL_DISA},
     {"gpmc_oen_ren.gpmc_oen_ren",  OMAP_MUX_MODE0 | AM33XX_PULL_DISA},
     {"gpmc_wen.gpmc_wen",     OMAP_MUX_MODE0 | AM33XX_PULL_DISA},
     {"gpmc_ben0_cle.gpmc_ben0_cle",  OMAP_MUX_MODE0 | AM33XX_PULL_DISA},
     {NULL, 0},
    };

    Jin

  • My flash is 8bit.

    Another question:

     {"gpmc_wpn.gpmc_wpn",   OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP}  Why mode 7? In pdf to Beaglebone gpmc_wpn is Mode 0.

  • Since I don't use GPMC write protecttion. I don't think it matters.

    Jin

  • Dmitriy Falko said:

    My flash is 8bit.

    I am interested to hear back on your results.

    Thank you,

    Valentin