PIC32MX460F512L + Flash ?

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
microIC
Posts: 82
Joined: 06 Nov 2014 10:45

PIC32MX460F512L + Flash ?

#1 Post by microIC » 14 Jun 2016 23:57

Hi to all,

I need to store some data once during programing,address and some flags. I use PIC32 clicker2 board.
I have more that 2000 bytes to be stored, but I stuck at first step, reading flash.

Once program enter to routine below it is stacked ! Why? Anybody able to help?

Code: Select all

sub procedure citaj_flash() 'read flash
    dim cntint as integer
    dim memword as longword
    dim  memAddress as longword   'adresa na kojoj se PAGE nalazi a vidi se u memorijskoj mapi PIC32
    dim ptr as ^longword
   
    memAddress = 0x9D07E000      ' page address        ' pocetna adresa flash memorije u chipu  treba mi 1024 byta
    ptr = memAddress                   'pocetna adresa
                     
  for cntint= 0 to 127  'read 1 row of data 128*32 bits
    
                              memword = ptr^  'read longword
                              longwordtostr(memword,pomstr40) 'store for print
                              memAddress=memaddress + 1 'next address 
                              ptr = memAddress  'adresa+1
                              if test=1 then
                                                        uart2_write_text(pomstr40)
                                                        uart2_write_text(" ")
                              end if


   next cntint
   uart2_write(13)
   uart2_write(10)
 end sub
if I understand well one flash page looks like on pdf file attached.

Thanks,Damir
Attachments
pic32MX460F512L_flash (version 1).pdf
(224.98 KiB) Downloaded 190 times

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: PIC32MX460F512L + Flash ?

#2 Post by phil31 » 16 Jun 2016 11:22

hi,

longwordtostr(memword,pomstr40) 'store for print
memAddress=memaddress + 1 'next address
ptr = memAddress 'adresa+1
i suppose that "pomstr40" is big enough for a longword string ? (as string[10])

why you do
memAddress=memaddress + 1 'next address
ptr = memAddress

faster :
inc(ptr)


try to read a single longword first

no problem with the uart2 ? others debug messages are working ?

regards

microIC
Posts: 82
Joined: 06 Nov 2014 10:45

Re: PIC32MX460F512L + Flash ?

#3 Post by microIC » 16 Jun 2016 23:12

Hi Phil,

thanks for answer. I know how to do shortcut for address increment but I put all possible steps to be sure that command are not problem because flash is not readable. What I try is to write a row of data or full page by writing 8 rows.
I am still looking for solution.
Thanks Damir

User avatar
uros.cvetinovic
mikroElektronika team
Posts: 803
Joined: 14 Dec 2015 09:24

Re: PIC32MX460F512L + Flash ?

#4 Post by uros.cvetinovic » 20 Jun 2016 17:18

Hi Damir,

Can you please zip and send me your whole project?
I would like to test it.

Best regards,

Uros

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: PIC32MX460F512L + Flash ?

#5 Post by phil31 » 21 Jun 2016 21:15

microIC wrote:Hi Phil,

thanks for answer. I know how to do shortcut for address increment but I put all possible steps to be sure that command are not problem because flash is not readable. What I try is to write a row of data or full page by writing 8 rows.
I am still looking for solution.
Thanks Damir
maybe your problem is not during the read operation .. (read is easy)
but during the previous write row ...?
check the Microchip PIC32MX section 6 pdf (61121F.PDF) .. all is detailed to allow write

regards

microIC
Posts: 82
Joined: 06 Nov 2014 10:45

Re: PIC32MX460F512L + Flash ?

#6 Post by microIC » 27 Jun 2016 21:28

Hi to all,

thanks for all your help. I put it hold for few days as I should finish UART1 interrupt problem first.
I am able to write to locations in flash as well as keep bytes in RAM. will continue with read same data from flash soon.

Thanks
Damir

Post Reply

Return to “mikroBasic PRO for PIC32 General”