FX3S CyU3PSibPartitionStorage limited to two user data partitions?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BrWu_4382966
Level 1
Level 1
5 replies posted First reply posted First question asked

In my code, based on the cyfx3s_msc example, I would like to have up to 4 user data partitions.

The function arguments are commented (as below) that partCount should be less or equal to 4.

extern CyU3PReturnStatus_t

CyU3PSibPartitionStorage (

uint8_t   portId,                       /**< Storage port to do the partitioning on. */

uint8_t   partCount,                    /**< Total number of partitions required. Should be less than or equal to 4. */

uint32_t *partSizes_p,                  /**< Sizes for each of the first (N - 1) partitions. The remaining storage on the device will be assigned to the last partition. */

uint8_t  *partType_p                    /**< Type for each partition (boot or data partition). */

);

       

My CyU3PSibPartitionStorage call returns CY_U3P_SUCCESS when I provide partCount 4, and four corresponding values for partSizes_p and partType_p.

Create partition idx: 0 port: 0 partCount: 4 partsize[0]: 1000000 parttype[0]: CY_U3P_SIB_LUN_DATA(0xDA)

Create partition idx: 1 port: 0 partCount: 4 partsize[1]: 1000000 parttype[1]: CY_U3P_SIB_LUN_DATA(0xDA)

Create partition idx: 2 port: 0 partCount: 4 partsize[2]: 1000000 parttype[2]: CY_U3P_SIB_LUN_DATA(0xDA)

Create partition idx: 3 port: 0 partCount: 4 partsize[3]: 1000000 parttype[3]: CY_U3P_SIB_LUN_DATA(0xDA)

CyU3PSibPartitionStorage port 0 Created 4 new partitions return code: 0

But when I reboot the device to use the new layout, there only exist two valid user partitions and two new invalid partitions which are marked as type CY_U3P_SIB_LUN_BOOT.

Found a device on port 0

        ... numUnits=6 ...

Dev 0, Unit 0: location=1 numBlocks=8192

Dev 0, Unit 1: location=2 numBlocks=8192

Dev 0, Unit 2: location=0 numBlocks=1000000

Dev 0, Unit 3: location=0 numBlocks=1000000

Dev 0, Unit 4: location=1 numBlocks=8192

Dev 0, Unit 5: location=2 numBlocks=8192

Digging deeper, I looked in the FX3 SDK source zip and the file sdk/firmware/src/storage/cyu3sib_fx3s.c:1301 there is a comment which reads:

/* This function partitions the user area of the card into two. */

CyU3PReturnStatus_t

CyU3PSibPartitionStorage (...)

So can the eMMC user area only be split in two partitions? The CyU3PSibPartitionStorage certainly accepts more and returns a successful result. 

The JEDEC standard (image below) seems to indicate there are always the BOOT1 and BOOT2 partitions and that it should be possible to have four General Purpose Area partitions.  It seems those aren't used and the CyU3PSibPartitionStorage call is just writing a custom Cypress-specific partition table to the eMMC flash itself, is that the case?

Is it possible to eliminate the BOOT1 and BOOT2 partitions? Is there any way to configure 2+ USER data partitions?

Thanks for any help, this is a critical issue for me at the moment.

jedec_emmc_partitions.png

0 Likes
1 Solution

My testing plan is pretty clear in the Linux commands above.  I didn't get to file transfers on Windows because the partitions didn't enumerate properly and matched the issue I was seeing in Linux).  Something that's obviously different between our two approaches is I am using one FX3S with two eMMC flash chips on Storage port 0 and Storage port 1 (which I referred to as Dev0 and Dev1) vs one SD card.

At this point I had to move on and have implemented my own virtual partition table while only relying on CyU3PSibCreatePartition to make one large partition on both flash parts.  My implementation seems to be working well so far and can go far beyond the (arbitrary?) 4 partition limit. Max LUNs for a Mass storage device is 16 I think... I would however like to understand why that API is behaving the way it is...

View solution in original post

0 Likes
7 Replies
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hello,

"But when I reboot the device to use the new layout, there only exist two valid user partitions and two new invalid partitions which are marked as type CY_U3P_SIB_LUN_BOOT."

=> Can you please share snapshots of this case?

I tried changing the "CY_FX_SIB_PARTITIONS" to "4" and tried power cycling the device (using SD card) but there was no issue as mentioned above.

Regards,
Yashwant

0 Likes

Starting from the base sample project, I did as you did and just changed CY_FX_SIB_PARTITIONS to 4 but continued to have issues. I tried with two different custom hardware platforms (eMMC) with different PCB revisions, and they both exhibited the same problem but were only slightly different in which drives would work or not.  I could sometimes get all eight 16GB LUNS to enumerate properly, but was never able to successfully read from all eight without I/O errors. Below is an example from one of the attempts. You can still see on Dev 0 that Unit 4 and 5 are both the strange "Boot" partitions while on Dev 1, they partition correctly.  I'm also confident in the hardware as I have successfully tested writing to the entire 64GB flash and read/verified it as correct, but this was when using only 1-2 partitions.

Found a device on port 0

        Type=1, numBlks=124190720, eraseSize=524288, clkRate=96000000

        blkLen=512 removable=1, writeable=1, locked=0

        ddrMode=1, opVoltage=0, busWidth=2, numUnits=6

        cardCmdClass=2293

Dev 0, Unit 0: location=1 numBlocks=8192

Dev 0, Unit 1: location=2 numBlocks=8192

Dev 0, Unit 2: location=0 numBlocks=31047680

Dev 0: Found user partition

Dev 0, Unit 3: location=0 numBlocks=31047680

Dev 0: Found user partition

Dev 0, Unit 4: location=1 numBlocks=8192

Dev 0, Unit 5: location=2 numBlocks=8192

Port 0: Creating partitions as required

Port 0: Skipping boot partition 0

Port 0: Skipping boot partition 1

Dev 0, Unit 2: blkSize=512 numBlocks=31047680

Dev 0, Unit 3: blkSize=512 numBlocks=31047680

Dev 0, Unit 4: blkSize=512 numBlocks=31047680

Dev 0, Unit 5: blkSize=512 numBlocks=31047488

Found a device on port 1

        Type=1, numBlks=124190720, eraseSize=524288, clkRate=96000000

        blkLen=512 removable=1, writeable=1, locked=0

        ddrMode=1, opVoltage=0, busWidth=1, numUnits=3

        cardCmdClass=2293

Dev 1, Unit 0: location=0 numBlocks=31047680

Dev 1: Found user partition

Dev 1, Unit 1: location=0 numBlocks=31047488

Dev 1: Found user partition

Dev 1, Unit 2: location=0 numBlocks=124190720

Dev 1: Found user partition

Port 1: Creating partitions as required

Dev 1, Unit 0: blkSize=512 numBlocks=31047680

Dev 1, Unit 1: blkSize=512 numBlocks=31047488

Dev 1, Unit 2: blkSize=512 numBlocks=31047680

Dev 1, Unit 3: blkSize=512 numBlocks=31047680

Calling USB Connect

USB event 0 received

USB event 4 received

USB Set Config completed

ubuntu:~/Cypress$ lsscsi -s

[3:0:0:0]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sda   15.8GB

[3:0:0:1]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdb   15.8GB

[3:0:0:2]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdc        -

[3:0:0:3]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdd        -

[3:0:0:4]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sde   15.8GB

[3:0:0:5]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdf   15.8GB

[3:0:0:6]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdg   15.8GB

[3:0:0:7]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdh   15.8GB

ubuntu:~/Cypress$ sudo dd if=/dev/sda bs=8 count=1 | xxd

1+0 records in

1+0 records out

8 bytes copied, 0.00659513 s, 1.2 kB/s

00000000: 0000 0000 0000 0000                      ........

ubuntu:~/Cypress$ sudo dd if=/dev/sdb bs=8 count=1 | xxd

1+0 records in

1+0 records out

8 bytes copied, 0.00666017 s, 1.2 kB/s

00000000: 0000 0000 0000 0000                      ........

ubuntu:~/Cypress$ sudo dd if=/dev/sdc bs=8 count=1 | xxd

dd: error reading '/dev/sdc': Input/output error

0+0 records in

0+0 records out

0 bytes copied, 0.0892561 s, 0.0 kB/s

ubuntu:~/Cypress$ sudo dd if=/dev/sdd bs=8 count=1 | xxd

dd: error reading '/dev/sdd': Input/output error

0+0 records in

0+0 records out

0 bytes copied, 0.0849689 s, 0.0 kB/s

ubuntu:~/Cypress$ sudo dd if=/dev/sde bs=8 count=1 | xxd

1+0 records in

1+0 records out

8 bytes copied, 0.00755179 s, 1.1 kB/s

00000000: 0000 0000 0000 0000                      ........

ubuntu:~/Cypress$ sudo dd if=/dev/sdf bs=8 count=1 | xxd

1+0 records in

1+0 records out

8 bytes copied, 0.0058862 s, 1.4 kB/s

00000000: 0000 0000 0000 0000                      ........

ubuntu:~/Cypress$ sudo dd if=/dev/sdg bs=8 count=1 | xxd

1+0 records in

1+0 records out

8 bytes copied, 0.00838905 s, 1.0 kB/s

00000000: 0000 0000 0000 0000                      ........

ubuntu:~/Cypress$ sudo dd if=/dev/sdh bs=8 count=1 | xxd

dd: failed to open '/dev/sdh': No medium found

0 Likes

Hello,


As mentioned in Reponse 1,

     I tried changing the "CY_FX_SIB_PARTITIONS" to "4" and tried power cycling the device (using SD card) but there was no issue as mentioned above.

I tried this on Windows 10 and i see you are using Linux (Ubuntu).

Can you please try the same firmware in Windows and see if the issue still persists?


Regards,
Yashwant

0 Likes

No, didn't work there either.

0 Likes

Hello,

" I could sometimes get all eight 16GB LUNS to enumerate properly, but was never able to successfully read from all eight without I/O errors."

=> Can you please elaborate your test setup? Are you using 2 FX3S's and two eMMC's in the test setup?

Also, can you elaborate your test procedure in Linux and Windows?

I tried the following to simulate a stress test (programming and power cycling almost 30times) with a 16GB SD card connected to S0 port of an FX3S:
1.) Set the "CY_FX_SIB_PARTITIONS" to "4" and programmed the device.

2.) The device enumerated with 4 partitions of 3.7 GB each.

3.) I copied a 3.5 GB file into all the 4 partitions and power cycled the device multiple times.

4.) And checked for proper enumeration of the 4 partitions as well as checked for the data stored in each partition.

There was no issue in all the times and the device enumerated properly everytime without any issue and the file could be opened properly as well in Windows 10.


Can you please such a setup and see if you still face the issue?

Also, since you mention the issue is Dev0 while Dev1 enumerates properly, can you swap out the eMMC's in the test and see if the issue is in Dev0 or in Dev1 (in case you are using two FX3S's) in your setup.

Regards,

Yashwant

0 Likes

My testing plan is pretty clear in the Linux commands above.  I didn't get to file transfers on Windows because the partitions didn't enumerate properly and matched the issue I was seeing in Linux).  Something that's obviously different between our two approaches is I am using one FX3S with two eMMC flash chips on Storage port 0 and Storage port 1 (which I referred to as Dev0 and Dev1) vs one SD card.

At this point I had to move on and have implemented my own virtual partition table while only relying on CyU3PSibCreatePartition to make one large partition on both flash parts.  My implementation seems to be working well so far and can go far beyond the (arbitrary?) 4 partition limit. Max LUNs for a Mass storage device is 16 I think... I would however like to understand why that API is behaving the way it is...

0 Likes

Hello,

"I would however like to understand why that API is behaving the way it is..."

=> Can you please swap the eMMC chips between S0 and S1(chip 0 in S0 swapped into S1 and vice versa) and see if you are still facing issue with the 3 and 4 partitions of S0 as you mentioned below (in bold)?

ubuntu:~/Cypress$ lsscsi -s

[3:0:0:0]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sda   15.8GB

[3:0:0:1]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdb   15.8GB

[3:0:0:2]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdc        -

[3:0:0:3]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdd        -

[3:0:0:4]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sde   15.8GB

[3:0:0:5]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdf   15.8GB

[3:0:0:6]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdg   15.8GB

[3:0:0:7]    disk    Cypress  FX3S MSC DEMO    0001  /dev/sdh   15.8GB

Please check and let me know.

Regards,

Yashwant

0 Likes