Mmc_Fat_RenameDir

General discussion on mikroPascal PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
karl567
Posts: 64
Joined: 19 Apr 2012 17:25
Location: Konstanz

Mmc_Fat_RenameDir

#1 Post by karl567 » 03 Mar 2019 16:41

Hi,

my compiler is mikroPascal PRO for dsPIC v.7.10.
In my project I am using a MicroSD card which I have FAT formatted under Windows 10.

All Mmc functions are working as expected, I can read, write, create directories,
except Mmc_Fat_RenameDir:

Mmc_Fat_RenameDir (filename1, filename2)
At first it seems to work: it renames filename1 to filename2, result is 0 (renaming was successful),
Windows Explorer also shows the renamed directory.

But when trying to open the renamed directory, Windows shows the error:
"The Path is not available..."

Are there known problems with the RenameDir function with Windows 10 formatted MicroSD cards?
Do you have a working example using the RenameDir function?

Regards, Karl

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Mmc_Fat_RenameDir

#2 Post by petar.suknjaja » 05 Mar 2019 08:48

Hi Karl,
Could you tell me if this happens on other SD cards also?
Could you post the code for review?
Kind regards,
Petar

karl567
Posts: 64
Joined: 19 Apr 2012 17:25
Location: Konstanz

Re: Mmc_Fat_RenameDir

#3 Post by karl567 » 05 Mar 2019 12:13

Hi Petar,

yes it happens with several MicroSD cards. Equal if formatted with Windows 10 (FAT) or formatted with function Mmc_Fat_QuickFormat.

Here a test code:

Code: Select all

program MicroSD_Test;

var
  Mmc_Chip_Select      : sbit at LATG.B9;            
  Mmc_Chip_Select_Direction  : sbit at TRISG.B9;

begin
  GIE_bit:=0;                              // Disable Interrupts globally
  SWDTEN_bit:=0;                       // Disable Watchdog Timer

  ANSELA := 0;
  ANSELB := 0;
  ANSELC := 0;
  ANSELD := 0;
  ANSELG := 0;

  PLLFBD := 68;                            // MCU 140MHz
  CLKDIV := 0x0000;
  ACLKCON3 := 0xb4c1;                 // USB 48 MHz
  ACLKDIV3 := 7;
  Delay_ms(300);

  SPI2_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, _SPI_PRESCALE_SEC_1, _SPI_PRESCALE_PRI_64,
                    _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
  Delay_ms(100);
  if Mmc_Fat_Init() = 0 then               // reinitialize spi at higher speed
  SPI2_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, _SPI_PRESCALE_SEC_1, _SPI_PRESCALE_PRI_4,
                    _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
  Delay_ms(100);

  Mmc_Fat_QuickFormat('TEST');
  Mmc_Fat_MakeDir('DIRx', 0x10);
  Mmc_Fat_RenameDir('DIRx','DIRy');
  
  while (TRUE) do
  begin
  end;

end.
The renamed Directory ('DIRy') is shown in Explorer but when trying to open, Windows says:
"The Path is not available...". Attached a Screencopy showing the error.


Best regards,
Karl
Attachments
Screencopy.JPG
Screencopy.JPG (200.31 KiB) Viewed 3151 times

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Mmc_Fat_RenameDir

#4 Post by petar.suknjaja » 06 Mar 2019 16:03

Hi Karl,
One more thing, could you tell us what MCU/dev board are you using?
Kind regards,
Petar

karl567
Posts: 64
Joined: 19 Apr 2012 17:25
Location: Konstanz

Re: Mmc_Fat_RenameDir

#5 Post by karl567 » 06 Mar 2019 16:47

Hi Petar,

dspic33ep512mu810
Frequency: 140 MHz
The board is an own development.

Regards,
Karl

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Mmc_Fat_RenameDir

#6 Post by petar.suknjaja » 07 Mar 2019 16:54

Hi Karl,
Could you try to reformat the SD card on the windows 7 as fat16?
Kind regards,
Petar

karl567
Posts: 64
Joined: 19 Apr 2012 17:25
Location: Konstanz

Re: Mmc_Fat_RenameDir

#7 Post by karl567 » 08 Mar 2019 08:05

Hi Petar,

I have no Windows 7. But I tried with Windows 8.1 and Windows 10.

Best Regards,
Karl

karl567
Posts: 64
Joined: 19 Apr 2012 17:25
Location: Konstanz

Re: Mmc_Fat_RenameDir

#8 Post by karl567 » 13 Mar 2019 08:48

Hi Petar,

could you reproduce in the meanwhile the RenameDir error?
Is there a chance to get a solution?

Best regards,
Karl

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Mmc_Fat_RenameDir

#9 Post by petar.suknjaja » 14 Mar 2019 17:28

Hi Karl,

I've manage to reproduce the same behavior,
I've reported this bug to our developers, and it will be fixed.

Kind regards,
Petar

Post Reply

Return to “mikroPascal PRO for dsPIC30/33 and PIC24 General”