Issue with PIC32 internal program flash r/w

General discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
Rickeus
Posts: 2
Joined: 08 Jul 2014 14:52

Issue with PIC32 internal program flash r/w

#1 Post by Rickeus » 08 Jul 2014 15:45

Hello,

I'm developping an application using LV32MX v6 with PIC32MX460F512L with MikroPascal Pro for PIC32.

I need to save / retrieve data from internal program flash. After having reading infos from Microchip doc, I started to write some code to do the job using the provided Flash library, without success... Then I decided to try the example that came with compiler, Flash.mpp32, slightly modified to see activity on RA3 led:

Code: Select all

{*
 * Project name:
     Flash (Flash writing example)
 * Copyright:
     (c) Mikroelektronika, 2012.
 * Revision History:
     20110105:
       - initial release;
 * Description:
     This is a simple demonstration how to use to PIC32's internal flash memory to
     store data. The data is being written starting from the given location;
     then, the same locations are read and the data is displayed on PORTB and PORTD.
 * Test configuration:
     MCU:             P32MX460F512L
                      http://ww1.microchip.com/downloads/en/DeviceDoc/61143G.pdf
     Dev.Board:       EasyPIC Fusion v7
                      http://www.mikroe.com/easypic-fusion/
     Oscillator:      XT PLL 8, 80.000MHz
     Ext. Modules:    None.
     SW:              mikroPascal PRO for PIC32
                      http://www.mikroe.com/mikropascal/pic32/
 * NOTES:
     - Turn ON PORTB  and PORTD LEDS at SW15 (board specific).
 *}

program Flash;

var rowbuff : array[128] of dword;
var i, Address : dword;
var ptr : ^dword;

begin
  AD1PCFG := 0xFFFF;
  TRISA := 0;
  LATA := 0;
  LATB := 0;
  TRISB := 0;
  LATD := 0;
  TRISD := 0;

  Address :=  0x9d001000;

  PORTAINV := 0x08;
  for i := 0 to 127 do
    rowbuff[i] := i + (i shl 16);

  Flash_Write_Row(Address,@rowbuff);  // write one row
  PORTAINV := 0x08;
  ptr := Address;
  for i := 0 to 127 do
  begin
    LATB := ptr^;
    LATD := ptr^ shr 16;
    Inc(ptr);
    PORTAINV := 0x08;
    Delay_ms(150);
  end;

  Delay_ms(1000);

  Flash_Erase_Page(Address);            // erase page
  Flash_Write_Word(Address, 0xAAAAAAAA);// write one word

  ptr := Address;
  LATB := ptr^;
  LATD := ptr^ shr 16;

end.

And I have the same problem, I'm unable to see the data written with the Flash_Write_Row() procedure on PORT A&D LEDs. But the last part of the program, which is using Flash_Write_Word() is working, I can see the 0xAAAAAAAA displayed by the leds.
I've already checked in the configuration of the project if writing on program flash is enabled.
I can't find any clue in order to see if it's a writing or reading problem ...

So any help will be highly appreciated.

Thx!

User avatar
dejan.odabasic
mikroElektronika team
Posts: 2649
Joined: 30 Apr 2012 14:20

Re: Issue with PIC32 internal program flash r/w

#2 Post by dejan.odabasic » 10 Jul 2014 13:22

Hello,

Thank you for reporting this problem.
I have managed to replicate this issue and I noticed our developers about it.

They will solve it as soon as possible.

Best regards.

Rickeus
Posts: 2
Joined: 08 Jul 2014 14:52

Re: Issue with PIC32 internal program flash r/w

#3 Post by Rickeus » 13 Aug 2014 10:08

Thank you Dejan for taking this into account.

Still no news from dev team ?

From now I have a workaround by using the I2C serial eeprom but I would like to use the processor flash for the final release.

Best regards.

ilferrari
Posts: 195
Joined: 18 Nov 2013 09:09

Re: Issue with PIC32 internal program flash r/w

#4 Post by ilferrari » 29 Oct 2014 08:25

Hi, same problem for me, see

Flash library not working

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Issue with PIC32 internal program flash r/w

#5 Post by filip » 30 Oct 2014 11:02

Hi,

I apologize for the inconvenience caused by this.

Please find the fixed library in the attachment, put it in the Uses subfolder in the compiler's installation folder instead of the old one.

Regards,
Filip.
Attachments
__Lib_FLASH.rar
(1.32 KiB) Downloaded 271 times

Post Reply

Return to “mikroPascal PRO for PIC32 General”