|
|
View previous topic :: View next topic |
Author |
Message |
rbgorbet
Joined: 15 Feb 2007 Posts: 17
|
problems with 16F877A when code goes above 800h |
Posted: Fri Feb 16, 2007 1:21 am |
|
|
Hi all.
I'm developing a project using a 16F877A. I'm
clocking at 20MHz, compiling using CCS PCM 3.098
(old, I know), and programming using Shane Tolmie's
bootloader and Bootloader+ v1.02 on the windows side
(www.microchipc.com/PIC16bootload).
The project includes a UART for debug info, and
I do the standard flashing a LED on reset and printing
a "hello world" to show it's running. I went through
dozens of increasingly complex code versions with the
bootloader and testing over the UART and everything was
fine.
Then, as the code became more complex/big, sometimes I
started getting garbage over the UART when the code ran
after downloading. On a reset, same thing. Occasionally,
I would see snippets of my code being printed out the UART,
or the code would end up in places where it shouldn't be.
I suspected a RAM problem (too many variables overwriting
each other and possibly overwriting code). My RAM usage
was listed as 55-85% in the LST file, so it was possible
I guess. I went to 16-bit pointers (#DEVICE *=16) to allow access to the
upper 256k of data memory, and that didn't solve the problem.
My ROM usage was near 25%, so lots of ROM.
I tried commenting out different portions of code, and there
seemed to be less impact based on what was commented rather
than how much. So it seems the code is getting too big, despite
the stats on ROM and RAM usage.
Then I realized that as long as the code stayed in the first
page of ROM (i.e., fit below 0x0800), it behaved properly.
All the code which misbehaves has code above 0x0800, in page 1
of ROM.
Has anyone encountered this before? Any thoughts as to why
or how to resolve it?
This code needs to be done in the next couple of days and
this has had me stymied for 2 days now.
Any help greatly appreciated.
Rob. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 16, 2007 1:54 am |
|
|
Quote: | I'm using CCS PCM 3.098
|
Version 3.098 is buggy. Read this thread and ask CCS if they will do
for you what they did for the person in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=27813
When you contact CCS, make sure you give them your customer
number, so they know you own the compiler. |
|
|
rbgorbet
Joined: 15 Feb 2007 Posts: 17
|
seems right, but... |
Posted: Fri Feb 16, 2007 3:14 pm |
|
|
PCM Programmer,
Thanks for responding so quickly. It does seem (and others have suggested) that it is a compiler problem. Knowing that others had similar issues with 3.098 helps only a bit. I have reported the issue to CCS and sent along the files showing the issue (and pointed them at this thread), but I know next-to-nothing about assembler so can't pinpoint the problem exactly.
In the meantime, it's 4pm Friday and I'm really concerned that I won't be able to work on this over the weekend, which I really need to do to get it done on time. I've got a copy of PCM 3.245 which support sent me before I ran into this bug (I purchased a copy but never installed it and lost the disk but had the receipt). But I can't install it because I don't have the .crg files (I'm currently working through that with sales).
I tried adding #ORG 7 in the code and that appeared to work, but only for a bit. As the code grew again, the problem resurfaced.
If you have any ideas about how to at least work around the issue maybe by just reserving the entire 2nd bank or something, while I wait for CCS, that would be awesome. I know it's a lot to ask, but I'm attaching two .zip files with a set of working and non-working files. You'll see that the non-working c-code runs over 800h, while the working code has the serial ISR commented out to keep the code in the first page. It doesn't seem to matter what I comment out, as long as the code fits below 800h.
Hmmm....I see one can't attach files. They are at:
http://tarsas.uwaterloo.ca/rbgorbet/pic_code/i_you_works.zip
http://tarsas.uwaterloo.ca/rbgorbet/pic_code/i_you_not_working.zip
Tonight I will try to learn more about assembler and what I SHOULD be seeing, so that I can try to find what I SHOULDN'T be seeing. Then I'll try to find a way around the problem. But if anyone has any suggestions, they're incredibly welcome.
Rob. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 16, 2007 3:28 pm |
|
|
Email CCS tech support and ask them to email you back the .crg files
for the version that you do have. They get requests like that every
day. They normally can get you a new .crg within a hour. Try it.
If you're desparate to get the .crg for the weekend, then call them.
They're on Central time in the U.S. So if they close at 5pm, you
have 1 1/2 hours left. That's plenty of time to call and get the new crg. |
|
|
rbgorbet
Joined: 15 Feb 2007 Posts: 17
|
too late |
Posted: Fri Feb 16, 2007 7:30 pm |
|
|
Unfortunately I had to go to a ceremony just after I sent that last post. I did e-mail CCS and asked for the .crg files, but haven't got a response. I guess I'll just spend the evening learning more about assembler. Obstacles are always opportunities.
Thanks for your help.
Rob. |
|
|
rbgorbet
Joined: 15 Feb 2007 Posts: 17
|
found 3.245 |
Posted: Sat Feb 17, 2007 12:22 am |
|
|
After scouring my house I ended up finding my 3.245 CD.
So I removed MPLAB 6.4 and the successful (but buggy) install of PCM 3.098 and the unsuccessful install of PCM 3.245 from earlier.
Then I installed MPLAB 7.50 and PCM 3.245 from the CD. It found and copied the .crg files which came on the CD. Now nothing will compile and it appears the compiler doesn't know what version it is. I created another thread...
http://www.ccsinfo.com/forum/viewtopic.php?t=29891
So it looks like despite finding the newer compiler version I'm still not out of the woods yet.
Rob. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|