AnsweredAssumed Answered

Problem using partition manager on eMMC device

Question asked by Anton Svensson on Sep 16, 2014
Latest reply on Nov 24, 2014 by Radek Sestak

Hi!

 

I'm trying to partition my eMMC memory using two partition managers.

 

I now have the problem that I'm only able to create the second partition on a specific place on the eMMC card. Otherwise it will timeout.

 

This is the relevant code snippet for partitioning.

 

        /* Open SD-CARD driver. */
        errorCode = fs_openComDrv(&pEmmcHandler,&pSdCardHandler, BSP_SDCARD_ESDHC_CHANNEL, sdCard, readOnly);
        
        /*Open Partitionmanager. */
        if(errorCode == MQX_OK)
        {
            errorCode = _io_part_mgr_install(pSdCardHandler,fs_PARTMAN_NAME1, 0);
            errorCode = _io_part_mgr_install(pSdCardHandler,fs_PARTMAN_NAME2, 0);
        }
        
        pPartManLog = fopen(fs_PARTMAN_NAME1, NULL);
        pPartManSecondary = fopen(fs_PARTMAN_NAME2, NULL);
        
        PMGR_PART_INFO_STRUCT part_info;
        uint32_t param;
        
        /* 42 Megabyte partition. */
        part_info.SLOT = 1;
        part_info.TYPE = PMGR_PARTITION_FAT32;
        part_info.START_SECTOR = 32;
        part_info.LENGTH = 8443000 - 64;

        param = 1;
        errorCode = ioctl(pPartManLog, IO_IOCTL_CLEAR_PARTITION,
                           (uint_32_ptr) &param);
        errorCode = ioctl(pPartManLog, IO_IOCTL_SET_PARTITION,
                           (uint_32_ptr) &part_info);
        
        /* 42 Megabyte partition. */
        part_info.SLOT = 2;
        part_info.TYPE = PMGR_PARTITION_FAT32;
        part_info.START_SECTOR = 8443000;
        part_info.LENGTH = 84430;

        param = 2;
        errorCode = ioctl(pPartManSecondary, IO_IOCTL_CLEAR_PARTITION,
                           (uint_32_ptr) &param);
        errorCode = ioctl(pPartManSecondary, IO_IOCTL_SET_PARTITION,
                           (uint_32_ptr) &part_info);
        param = 1;
        //errorCode = ioctl(pPartManLog, IO_IOCTL_VAL_PART, &param);
        errorCode = _io_mfs_install(pPartManLog, fs_FILE_SYSTEM_NAME, param);
        param = 2;
        //errorCode = ioctl(pPartManLog, IO_IOCTL_VAL_PART, &param);
        errorCode = _io_mfs_install(pPartManSecondary, fs_FILE_SYSTEM_SECONDARY, param);   

         pSdCardFsLogs = fopen(fs_FILE_SYSTEM_NAME, NULL);
        (void)ioctl(pSdCardFsLogs, IO_IOCTL_DEFAULT_FORMAT, NULL);   

         pSdCardFsSecondary = fopen(fs_FILE_SYSTEM_SECONDARY, NULL); <-- This will fail if I change the start_sector.
        (void)ioctl(pSdCardFsSecondary, IO_IOCTL_DEFAULT_FORMAT, NULL);

 

It will fail on the esdhc_read command.

        /* data is word aligned, maximize speed by copying directly from the register */      


        while (remains >= 4)
        {
            if (esdhc_ptr->IRQSTAT & (SDHC_IRQSTAT_DEBE_MASK | SDHC_IRQSTAT_DCE_MASK | SDHC_IRQSTAT_DTOE_MASK))
            {
                esdhc_ptr->IRQSTAT |= SDHC_IRQSTAT_DEBE_MASK | SDHC_IRQSTAT_DCE_MASK | SDHC_IRQSTAT_DTOE_MASK | SDHC_IRQSTAT_BRR_MASK; <--- Fails here, the DTOE flag is set after the first byte is read.
                return IO_ERROR;
            }

 

 

Anyone else that have had problems using eMMC and partitioning?

Outcomes