Searching \ for '[PIC]:Reading Flash' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/memory.htm?key=flash
Search entire site for: 'Reading Flash'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:Reading Flash'
2002\07\17@094124 by Jinx

face picon face
I don't seem to be getting the results I expect with this routine to
read the program memory of a F877. It seems to follow examples
in the manuals and MC literature, yet always returns 03FF. If I step
through it with MPLAB however it does return programmed values

eg, if 0910 contains 0843, then setting the address to 0910 and
stepping through in MPLAB will put 08 in hi and 43 in lo. Why isn't
it working in real life ? I don't see reference to paging in examples
and assumed that EEADR and EEADRH can access memory
contiguously from 0000 to 1FFF

If I add say a decf or an incf to change the data in lo/hi before the
routine exits then this is reflected in the LCD display (eg I can make
the LCD show 64 : 254), so it appears the routine really is reading
3FFF

        bank0                      ;copy address from bank0 RAM
        movf   add1h,w       ;address high
        bank2
        movwf  eeadrh

        bank0
        movf   addl,w        ;address low
        bank2
        movwf  eeadr

        bank3
        bsf    eecon1,eepgd  ;set to read Flash
        bsf    eecon1,rd          ;initiate read
        nop
        nop
        nop
        nop
        bank2                           ;copy data from bank2 to bank0 RAM
        movf   eedata,w
        bank0
        movwf  lo
        bank2
        movf   eedath,w
        bank0
        movwf  hi
        return                            ;exit with flash values in lo /
hi

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@094921 by Kieren Johnstone

picon face
Now I'm no expert (ahem) but sounds like a timing issue - you sure you've
got enough NOPs there (perhaps you borrowed code from an AN using a lower
clock speed)?  MPLAB might not be as time-sensitive as the device or
something.

Hope this helps,
Kieren

{Quote hidden}

_________________________________________________________________
Join the world s largest e-mail service with MSN Hotmail.
http://www.hotmail.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@100356 by Spehro Pefhany

picon face
At 01:39 AM 7/18/02 +1200, you wrote:
>I don't seem to be getting the results I expect with this routine to
>read the program memory of a F877. It seems to follow examples
>in the manuals and MC literature, yet always returns 03FF. If I step
>through it with MPLAB however it does return programmed values

How do you know the program memory is actually what you think it is?

If you are writing it elsewhere (as opposed to predefining it in
the program), do you have code write enabled in the configuration?

If you are predefining it, is your programmer actually doing what
you think it is?

0x3FF is what you would get if the memory was not programmed

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
.....speffKILLspamspam.....interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
9/11 United we Stand

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@101150 by Susan Schunemann

flavicon
face
This is Susan, I am an IT Recruiter for the New England area and I am
presently recruiting to fill a position in the state of Massasachussetts'
for someone with a background in PIC Microcontroller chips.... Would you be
interested in learning more about this opportunity or do you happen to know
anyone who would have the skillset described below??  If so please feel free
to pass along either my info to them or their contact information to me.
Any help would be greatly appreciated.   If you can't think of anyone thanks
for the effort and I hope you have a great day!


C++ Must Have: PIC Microcontroller chip exp. Embedded Systems Software
Engineering/Software Developement

Skills Required: C++, Embedded Systems, Microcontroller, Software
Development, Medical Device

Susan Schunemann
Senior Technical Recruiter
Phone: (888) 288-0069 ex14
Fax:   (888) 288-0087

Sienna Technologies, Inc.
9 Trafalgar Square
Suite 100
Nashua, NH 03063

THE ULTIMATE RESOURCE FOR YOUR TECHNOLOGY SOLUTIONS

{Original Message removed}

2002\07\17@101819 by Jinx

face picon face
> How do you know the program memory is actually what you think it is?

I have this

org 910

testbytes db 0x08,0x43,0x09,0x44,0x0a,0x45

and those bytes do appear in the Program Window at 910

As I mentioned, stepping through it with MPLAB returns non-3FFF
from those addresses

> 0x3FF is what you would get if the memory was not programmed

And that's when my brain starts hurting

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@102233 by Carlos Ojea

flavicon
face
>I don't seem to be getting the results I expect with this routine to
>read the program memory of a F877. It seems to follow examples
>in the manuals and MC literature, yet always returns 03FF. If I step
>through it with MPLAB however it does return programmed values



Do you have interrupts enabled while you are reading the program memory ?

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@102409 by Jinx

face picon face
> Now I'm no expert (ahem)

Oooh, do you think that nasty cough is holding you back ?

> but sounds like a timing issue - you sure you've got enough NOPs
> there (perhaps you borrowed code from an AN using a lower clock
> speed)?  MPLAB might not be as time-sensitive as the device or
> something

Some of MC's own examples doesn't agree with other MC examples

For instance, their Checksum code example has no NOPs, yet
the manual states that two NOPs at least are required as the uC
is busy getting data. I've tried it with 6 and it made no difference.
AFAICT the data fetch is independent of clock speed, it requires
clock cycles. But it's getting a good result with MPLAB that's got
me stumped. I can trace addresses, banks and locations with a
Watch Window and it all looks fine

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@102835 by Jinx

face picon face
> This is Susan, I am an IT Recruiter for the New England area

Yes, I'd love a job in New England. I'm in New Zealand and I
used to live in Old England. Spooky eh ? Will you pay my daily
commuting expenses ? (nothing less than business class though,
or you go away, y'hear ?)

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@102839 by Jinx

face picon face
> Do you have interrupts enabled while you are reading the
> program memory ?

No interrupts are being used at all

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@103244 by Bob Ammerman

picon face
Try reading one of the code locations where the program itself is stored.

Bob Ammerman
RAm Systems

{Original Message removed}

2002\07\17@104906 by Jinx

face picon face
> Try reading one of the code locations where the program itself
> is stored.

Yes I had a go at that. This is what's creepy - I just took out the
NOPs and of course it didn't work (even though MC try it on in
one of their code examples). But, when I put the NOPs back in
it did, even though the program is ostensibly identical to how
it was when I had the problem. So it looks like "my" code was
OK all the time but something in either MPLAB, PSP or MPASM
wasn't. Hopefully it's just one of those freak things I can do without

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@105532 by Drew Vassallo

picon face
>Try reading one of the code locations where the program itself is stored.

That's a great idea.  Also, I was thinking you might want to use that same
READ code and try it on the EEPROM instead of Program Memory.  Just change
where the EEPGD points to.

One last thought:  are you sure you're PROGRAMMING those locations into the
chip?  Some programmers default to the last code locations that were
programmed, and if you've added code, or gone beyond that range, obviously
it won't program it.

Try programming the ENTIRE chip, if you haven't already.

--Andrew

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@110409 by Susan Schunemann

flavicon
face
Would LOVE to be able to pay the expenses...you sound like a hoot....it
sounds like it would be worth it (smile)

Susan Schunemann
Senior Technical Recruiter
Phone: (888) 288-0069 ex14
Fax:   (888) 288-0087

Sienna Technologies, Inc.
9 Trafalgar Square
Suite 100
Nashua, NH 03063

THE ULTIMATE RESOURCE FOR YOUR TECHNOLOGY SOLUTIONS

{Original Message removed}

2002\07\17@110949 by Jochen Feldhaar

flavicon
face
Susan,

in that case you'd better provide him with a laptop and a mobile phone,
or we'll miss his posts during the long trips...


Susan Schunemann schrieb:
{Quote hidden}

> {Original Message removed}

2002\07\17@112323 by Susan Schunemann

flavicon
face
NAAAAA roughing it is good for the character....yours as well as HIS....All
this activity but no real interest in the posting?? Whats up with that?

Susan Schunemann
Senior Technical Recruiter
Phone: (888) 288-0069 ex14
Fax:   (888) 288-0087

Sienna Technologies, Inc.
9 Trafalgar Square
Suite 100
Nashua, NH 03063

THE ULTIMATE RESOURCE FOR YOUR TECHNOLOGY SOLUTIONS

{Original Message removed}

2002\07\17@113819 by PDRUNEN

picon face
part 1 2464 bytes content-type:multipart/alternative; (decoded 7bit)


--part1_bc.29223810.2a66e905_alt_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

In a message dated 7/17/2002 9:29:38 AM Central Daylight Time,
EraseMEjoecolquittspam_OUTspamTakeThisOuTCLEAR.NET.NZ writes:


> No interrupts are being used at all
>

Hi,

If you are disabling the interrupts with BCF GIE during this routine, you
also need a loop to check that GIE really got cleared.


something like:

      disable_gie: BCF GIE
                        BTFSC GIE
                        GOTO  disable_gie        ;clear it again.

Attached is the code I use to read a Flash location in the 876.

Cheers,

Paul


--part1_bc.29223810.2a66e905_alt_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

<HTML><FONT FACE=arial,helvetica><FONT  SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">In a message dated 7/17/2002 9:29:38 AM Central Daylight Time, joecolquittspamspam_OUTCLEAR.NET.NZ writes:<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">No interrupts are being used at all<BR>
</BLOCKQUOTE><BR>
<BR>
Hi,<BR>
<BR>
If you are disabling the interrupts with BCF GIE during this routine, you also need a loop to check that GIE really got cleared.&nbsp; <BR>
<BR>
<BR>
something like:<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disable_gie: BCF GIE<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BTFSC GIE<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GOTO&nbsp; disable_gie&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;clear it again.<BR>
<BR>
Attached is the code I use to read a Flash location in the 876.<BR>
<BR>
Cheers,<BR>
<BR>
Paul<BR>
<BR>
</FONT></HTML>
--part1_bc.29223810.2a66e905_alt_boundary--


part 2 2841 bytes content-type:text/plain; name="flash1.inc"
(decoded quoted-printable)


;***********************************************************************************
;    Project Name:            
;    Version        
;    Date:                
;
;   Module:        FLASH.INC
;   Module will provide basic read/write to the internal FLASH for the 873/876
;
;  Databyte and Addrbyte must be located in locations $70 or above
;***********************************************************************************
;
; MODULE:        FREAD
;                     ; Author:         Paul J. VanDrunen
;         ;
;Description:
;
; This module will read the data from the 876 internal FLASH ROM.
; Module will store the current value of the interrupt control register INTCON
; and the STATUS register. The address to access in the FLASH must be written into
; location ADDRBYTE and ADDRBYTE1 before accessing.
; The location DATABYTE will contain the value from the FLASH location on return.
; Interrupt will be disabled during the read but will be restored by value in
; INTCONTEMP.
; ;
; Variables:
;     External:        
;        DATABYTE:          contains the value returned from the routine (FLASH LSB)
;        DATABYTE1:        contains the value returned from the routine (FLASH MSB)
;        ADDRBYTE:        contains the FLASH LSB address on entry
;        ADDRBYTE1:        contains the FLASH MSB address on entry
;        Note:        above variables must be located in locations $70 or above
;     Internal:
;        INTCONTEMP:        used to save the value of the INTCON register on entry
;        SAVESTATUS:        used to save the value of the STATUS register on entry
;        EEADR:        Address register for EEPROM
;        EEDATA:        Data from EEPROM read
;
;        
;
; Flags:        
; ;
; Classification: ;
; ;
; Entry Point: ; Exit : Return
; ; ;
;
;History:
; ;
;-----------------------------------------------------------------------------------------------------------
FREAD:                
               CLRWDT
               MOVF        INTCON,W                ;saves the INTCON register
               MOVWF        INTCONTEMP                ;and stores it in INTCONTEMP
Disable_gie        BCF        GIE                ;now disable Interrupts
               BTFSC        GIE
               GOTO        Disable_gie
               MOVF        STATUS,W                ;save the STATUS Register
               MOVWF        STATUS_TEMP1        ;into STATUSTEMP
               MOVF        ADDRBYTE,W                ;Move the Address location into W.
               BSF        IRP                ;set to access bank 2,3
               BSF        RP1                ;sets both of these
               BCF        RP0                ;bits for bank2 RAM access
               MOVWF        EEADR                ;move W into register EEADR
               MOVF        ADDRBYTE1,W
               MOVWF        EEADRH
               BSF        RP0                ;set for bank3
               BSF        EEPGD                ;set for flash memory read
               BSF        RD                ;set the ee read bit
               NOP
               NOP
               BCF        RP0                ;return to bank 2
               MOVF        EEDATA, W                ;store the ee data into w register
               MOVWF        DATABYTE                ;store ee data into DATABYTE
               MOVF        EEDATH,W
               MOVWF        DATABYTE1
               BCF        IRP                ;return to bank 0,1 access
               MOVF        STATUS_TEMP1,W        ;restore the                MOVWF        STATUS                ;status register
               MOVF        INTCONTEMP,W        ;restore the
               MOVWF        INTCON                ;interrupt control register
               RETURN


;-----------------------------------------------------------------------------------------------------------



part 3 144 bytes
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@115242 by Carlos Ojea

flavicon
face
>This is Susan, I am an IT Recruiter for the New England area and I am
>presently recruiting to fill a position in the state of Massasachussetts'

>for someone with a background in PIC Microcontroller chips....


I am working in Spain...
is it possible to work from home?

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@115905 by Olin Lathrop

face picon face
> This is Susan, I am an IT Recruiter for the New England area ...

This should have an [AD] tag, not [PIC].


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@123532 by Alan B. Pearce

face picon face
>> 0x3FF is what you would get if the memory was not programmed

>And that's when my brain starts hurting

Do you have code protect on? I have a feeling that code protect on will give
0x3ff. I have not yet got through all the messages to see if someone else
suggested this.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@123757 by Alan B. Pearce

face picon face
>Yes, I'd love a job in New England. I'm in New Zealand and I
>used to live in Old England. Spooky eh ? Will you pay my daily
>commuting expenses ? (nothing less than business class though,
>or you go away, y'hear ?)

Yeah I'm the same, but used to live in NZ, but now live in Old England :)

Could do with some of those travel expenses too :)))

Now where is that [AD]: tag .... oh yes fallen in the bit bucket ...

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@131423 by Susan Schunemann

flavicon
face
Thanks it was my first posting...will know for next time

Susan Schunemann
Senior Technical Recruiter
Phone: (888) 288-0069 ex14
Fax:   (888) 288-0087

Sienna Technologies, Inc.
9 Trafalgar Square
Suite 100
Nashua, NH 03063

THE ULTIMATE RESOURCE FOR YOUR TECHNOLOGY SOLUTIONS

{Original Message removed}

2002\07\17@132010 by Susan Schunemann

flavicon
face
Unfortunately our client wants someone who can work "in-house" but if that
status changes I will let you know.  Thanks for the reply.

Susan Schunemann
Senior Technical Recruiter
Phone: (888) 288-0069 ex14
Fax:   (888) 288-0087

Sienna Technologies, Inc.
9 Trafalgar Square
Suite 100
Nashua, NH 03063

THE ULTIMATE RESOURCE FOR YOUR TECHNOLOGY SOLUTIONS

{Original Message removed}

2002\07\17@173959 by Russell McMahon

face
flavicon
face
Susan,

> NAAAAA roughing it is good for the character....yours as well as
HIS....All
> this activity but no real interest in the posting?? Whats up with that?

Try running it as something like

       [AD]: PIC Programmer position in Massachoosetts

(or where-ever) - we Noo-Zillanders aren't real good on US place names.

The [AD] subject line and properly related topic should bring it to more
peoples attention. Maybe (just maybe) use [PIC]: as subject tag.

The list isn't meant to be a general employment agency billboard BUT I'm
sure we are happy to have the odd offers of gainful employment posted. There
are so many messages on this list that some (like me) have to be a bit
selective about what we read - I skim headings and follow a thread where it
looks interesting and/or pertinent. In your case I only saw your ad because
I was interested in "Reading Flash".

I'm in NZ (so is Jinx) and so busy that I should not be sitting here reading
email, so I'm afraid that I personally will not be responding to your offer.
Hope you find someone who does.


regards

               Russell McMahon



{Quote hidden}

> {Original Message removed}

2002\07\17@181903 by David Duffy

flavicon
face
PDRUNEN@AOL.COM wrote:
>In a message dated 7/17/2002 9:29:38 AM Central Daylight Time,
>@spam@joecolquittKILLspamspamCLEAR.NET.NZ writes:
>
>>No interrupts are being used at all
>
>Hi,
>If you are disabling the interrupts with BCF GIE during this routine, you
>also need a loop to check that GIE really got cleared.

I don't believe that's a problem anymore in the current chips.
Regards...
___________________________________________
David Duffy        Audio Visual Devices P/L
U8, 9-11 Trade St, Cleveland 4163 Australia
Ph: +61 7 38210362   Fax: +61 7 38210281
New Web: http://www.audiovisualdevices.com.au
___________________________________________

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\17@214655 by Tony Nixon

flavicon
picon face
Hi Jinx,

I copied your code, but explicity set the RAM Page bits and it worked
OK, verified by receiving the data over the serial port using the
Terminator.

       movlw 0x00
       movwf add1h
       movlw 0x03
       movwf add1l
Loop    btfss PIR1,RCIF
       goto Loop

       movf RCREG,W
       call ReadEE
       incf add1l
       goto Loop

ReadEE  movf add1h,W     ; address high
       bsf STATUS,RP1   ; RAM Page 2
       movwf EEADRH

       bcf STATUS,RP1   ; RAM Page 0
       movf add1l,W     ; address low
       bsf STATUS,RP1   ; RAM Page 2
       movwf EEADR

       bsf STATUS,RP0   ; RAM Page 3
       bsf EECON1,EEPGD ; set to read Flash
       bsf EECON1,RD    ; initiate read
       nop
       nop
       bcf STATUS,RP0   ; RAM Page 2
       movf EEDATH,W
       bcf STATUS,RP1   ; RAM Page 0
       movwf  TXREG

       bsf STATUS,RP1   ; RAM Page 2
       movf EEDATA,W
       bcf STATUS,RP1   ; RAM Page 0
       movwf TXREG
       return


--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
KILLspamsalesKILLspamspambubblesoftonline.com


Jinx wrote:
{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\18@022132 by Quentin

flavicon
face
Jinx
I compared your code with what I have used successfully on a few
projects, everything checked out pretty much the same.
The only time I had a similar problem between stepping and running a
program (not Flash read code) was when I accidentally was writing to reg
0x070, the reg used by ICD. Stepping it worked fine, running the program
and it went into never-never land.

Quentin

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\18@054135 by Jinx

face picon face
> Best regards
>
> Tony

Thanks for your efforts Tony - it appears it's not a code problem
but a programmer thing. Hasn't done it again and I can't reproduce
it either. Don't know if that's a ;-) or a ;-(

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\18@054548 by Jinx

face picon face
> The only time I had a similar problem between stepping and running a
> program

Funny you should mention that - I've noticed that after using F9 to run
a section of code a few times, F9 will stop being a  Run key and just
step, like F7 does. Has anyone ever noticed this and have a fix ? For
the time being I just shut MPLAB down and re-run it and that resets
everything, but it's a thorough PITA. I'm using IDE version 5.30.00,
Processor version 7.3, Disassembler version 2.0, Device File version
3.37.00

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\18@073416 by Olin Lathrop

face picon face
> Funny you should mention that - I've noticed that after using F9 to run
> a section of code a few times, F9 will stop being a  Run key and just
> step, like F7 does.

I've never seen that before.  I've used the simulator a bit and the ICE
heavily on quite a few different chips and many revisions of MPLAB.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...