Home/Support/Support Forum/FAT_SHELL.C Error: Root directory full
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

FAT_SHELL.C Error: Root directory full

0 votes
I am currently developing on the RCM 6750 with an SD card attached.

My goal is to mount a FAT for both the on-board SFLASH as well as the SD card at the same time.

However, when running the sample program FAT_SHELL.C, I am unable to write to the mounted SFLASH. Both the SFLASH as well as the SD card appear to mount just fine, and I can write to the SD card without an issue.. but when attempting to write to the SFLASH, I receive the following error:

A> wr test.txt
Open '/test.txt' Error: Root directory full

Here's a screenshot illustrating the error:
https://gyazo.com/2c995bc639357236bc72f8e2b584f487

Partition A = SFLASH
Partition E = SD


I'm pretty new to rabbit programming, so any advice to remedy this problem or point me in the right direction would be greatly appreciated!

I have configured both devices in fat_config.lib to as follows:

#define FAT_MAXCU 3

#define _DRIVER_0 "SFLASH_FAT.LIB"
#define _DRIVER_0_INIT { "SF", sf_InitDriver, _DRIVER_CALLBACK, },
#define _DEVICE_0 { sf_InitDriver, _DEVICE_CALLBACK, 0, 0, FDDF_MOUNT_PART_ALL|FDDF_MOUNT_DEV_0, "SFLASH-1", },

#define _DRIVER_1 "SD_FAT.LIB"
#define _DRIVER_1_INIT { "SD", sd_InitDriver, _DRIVER_CALLBACK, },
#define _DEVICE_1 { sd_InitDriver, _DEVICE_CALLBACK, 0, 0, FDDF_MOUNT_PART_ALL|FDDF_MOUNT_DEV_1, NULL, },

#define PC_COMPATIBLE
#define FAT_REMOVABLE
#define FAT_SD_PART fat_part_mounted[4]

And of course a custom library for SD card setup macros:

#define SD_CD_PORT PBDR // Card Detect set to pin PB2
#define SD_CD_PORT_FR 0
#define SD_CD_PORT_FRSHADOW NULL
#define SD_CD_PORT_DDR PBDDR
#define SD_CD_PORT_DDRSHADOW &PBDDRShadow
#define SD_CD_PIN 2

#define SD_WP_PORT 0 // No Write Protect input used
#define SD_WP_PORT_FR 0
#define SD_WP_PORT_FRSHADOW NULL
#define SD_WP_PORT_DDR 0
#define SD_WP_PORT_DDRSHADOW NULL
#define SD_WP_PIN 0

#define SD_CS_PORT PEDR // Chip Select set to pin PE0
#define SD_CS_PORT_DRSHADOW &PEDRShadow
#define SD_CS_PORT_DDR PEDDR
#define SD_CS_PORT_FR PEFR
#define SD_CS_PORT_FRSHADOW &PEFRShadow
#define SD_CS_PORT_DDRSHADOW &PEDDRShadow
#define SD_CS_PORT_DCR PEDCR
#define SD_CS_PORT_DCRSHADOW &PEDCRShadow
#define SD_CS_PIN 0
#define SD_CS_PORT_OD 0

#define SD_TX_PORT_DR PCDR // TxC set to pin PC4
#define SD_TX_PORT_DRSHADOW &PCDRShadow
#define SD_TX_PORT_FR PCFR
#define SD_TX_PORT_FRSHADOW &PCFRShadow
#define SD_TX_PORT_DDR PCDDR
#define SD_TX_PORT_DDRSHADOW &PCDDRShadow
#define SD_TX_PORT_DCR PCDCR
#define SD_TX_PORT_DCRSHADOW &PCDCRShadow
#define SD_TX_PIN 4
#define SD_TX_PORT_OD 0

#define SD_RX_PORT_DR PCDR // RxC set to pin PC5
#define SD_RX_PORT_FR PCFR
#define SD_RX_PORT_FRSHADOW &PCFRShadow
#define SD_RX_PORT_DDR PCDDR
#define SD_RX_PORT_DDRSHADOW &PCDDRShadow
#define SD_RX_PIN 5

#define SD_PWR_PORT_DR 0 // Power control pin not used
#define SD_PWR_PORT_DRSHADOW NULL
#define SD_PWR_PORT_FR 0
#define SD_PWR_PORT_FRSHADOW NULL
#define SD_PWR_PORT_DDR 0
#define SD_PWR_PORT_DDRSHADOW NULL
#define SD_PWR_PORT_DCR 0
#define SD_PWR_PORT_DCRSHADOW NULL
#define SD_PWR_PIN 0
#define SD_PWR_PORT_OD 0
#define SD_PWR_PORT_ON 0

#define SD_LED_PORT_DR 0 // LED Output pin not used
#define SD_LED_PORT_DRSHADOW NULL
#define SD_LED_PORT_FR 0
#define SD_LED_PORT_FRSHADOW NULL
#define SD_LED_PORT_DDR 0
#define SD_LED_PORT_DDRSHADOW NULL
#define SD_LED_PORT_DCR 0
#define SD_LED_PORT_DCRSHADOW NULL
#define SD_LED_PIN 0
#define SD_LED_PORT_OD 0
#define SD_LED_PORT_ON 0

#define SD_CLK_PORT_DR PBDR // SclkC set to pin PB0
#define SD_CLK_PORT_FR 0
#define SD_CLK_PORT_FRSHADOW NULL
#define SD_CLK_PORT_DDR PBDDR
#define SD_CLK_PORT_DDRSHADOW &PBDDRShadow
#define SD_CLK_PORT_DCR 0
#define SD_CLK_PORT_DCRSHADOW NULL
#define SD_CLK_PIN 0
#define SD_CLK_PORT_OD 0

// Setup clock & control registers for serial port
#define SD_SPI_TACRSHADOW &TACRShadow
#define SD_SPI_SERPORT SBDR
#define SD_SPI_TCREG TACR
#define SD_SPI_TCRSHADOW &TACRShadow
#define SD_SPI_TCRVALUE 0
#define SD_SPI_SERSHADOW &SBERShadow
#define SD_SPI_SERVALUE SD_SPI_CLOCK_MODE
#define SD_SPI_SCRSHADOW &SBCRShadow
#define SD_SPI_SCRVALUE SD_SPI_CONTROL_VALUE
#define SD_SPI_DIVREG TAT6R
#define SD_SPI_DIVREGSHADOW &TAT6RShadow
#define SD_SPI_DIVISOR 0

// Macros for enabling and disabling the Card Select control line
#define SD_ENABLECS(DI) BitWrPortI(DI->csport,DI->csportdrShadow, 0, DI->cspin)
#define SD_DISABLECS(DI) BitWrPortI(DI->csport, DI->csportdrShadow, 1, DI->cspin)
#define SD_ENABLEPOW(DI) DI // Power enable not used
#define SD_DISABLEPOW(DI) DI

//SD serial port register offsets
#define SD_AR_OFFSET 1
#define SD_SR_OFFSET 3
#define SD_CR_OFFSET 4
#define SD_ER_OFFSET 5

#define SD_SPI_CONTROL_VALUE 0x0c // was 0x1c - Selects Port D as RxC alt. input
#define SD_SPI_TXMASK 0x80 // Control bits for starting TX or RX operations
#define SD_SPI_RXMASK 0x40
#define SD_SPI_CLOCK_MODE 0x08 // Sets Reverse Data Bit operation (MSB first)

// Use the necessary libraries for FAT operation
#use "FAT16.lib"
#use "SD_FAT.lib"
/*** EndHeader */



Thank you!
asked Mar 13, 2017 in Rabbit Software by dilbertgod New to the Community (18 points)

Please log in or register to answer this question.

1 Answer

0 votes
Can you work with a FAT filesystem on the serial flash if you don't enable your SD card driver?

There could be some issues with how the BIOS manages caches for multiple devices.

Have you explored setting some of the macros from fatconfig.lib to higher values?
answered Mar 24, 2017 by TomCollins Veteran of the Digi Community (1,362 points)
...