Forums

What's wrong?

Started by Unknown February 15, 2004
Hi all,
I'm really losing my mind now, been fighting with this for 8 days
now, I give up. I hope you can tell me what's wrong in my setup. :(

I self made a PIC18F8720 development board, and it seems to work,
because I can program the chip with no problems.

I'm using 100 nF SMD capacitors near every Vdd (including AVdd),
and an integrated clock oscillator. It's a 24 MHz CMOS part by
Epson.

I wrote a simple test program which is supposed to set all ports
to output (via the TRISx registers), and then put all of them to
the "HIGH" logic level (via the PORTx registers).

This is my code, as shown by IC-Prog:
0000: D00F 0000 0000 0000 0000 0000 0000 0000
0008: 0000 0000 0000 0000 0000 0000 0000 0000
0010: 0000 0E00 6E92 6E93 6E94 6E95 6E96 6E97
0018: 6E98 6E99 6E9A 0000 0000 0000 0000 0000
0020: 0EFF 6E80 6E81 6E82 6E83 6E84 6E85 6E86
0028: 6E87 6E88 0000 0000 0000 0000 0000 0000
0030: D7DE 0000 0000 0000 0000 0000 0000 0000

And this is the configuration:
Config1  = 2500
Config2  = 000F
Config3  = 0080
Config4  = 0081
Config5  = C0FF
Config6  = E0FF
Config7  = 40FF
ID Value = 0123456789ABCDEF

Is there anything wrong in my machine code (for this quick test
I don't want to nor I think I need to install MP-Lab.. I tried
it and hated it, I will write my own source level debugger and
assembler and release it to the PD after I'm finished).

Is the reset vector ok? It's supposed to be a BRA to 0010, where
it will meet a NOP (no reason in particular) and then the value
00 will be moved to W, which in turn will be moved to all the
TRISx registers. Then W will be loaded with FF, which will be
copied to all the PORTx registers. Finally (through some NOPs,
again, just to leave some space for inserting other code for
experiments) there's supposed to be a final BRA back to 0010.
Addresses don't represent bytes, but instruction words.

I know it's tedious to go through machine code.. but if you're
kind enough, and if the code or the configuration is wrong, please,
can you point me to the errors?

Or, in alternative, could some kind soul post a small .HEX file
with a demo program that just turns some port pins ON and some
others OFF, just to see if my problem lies in my hardware or in
my code?

I hope to get your valuable help.. I really don't know what to
experiment else.

Kindest regards,
Mike Forrest

Mike,

Start small. Write the smallest program you can to turn on a single bit. I 
recommend setting it low so you don't get confused by the internal pullups. 
You can test with a 1K resistor and and LED.

Write your small program.
        * Check the 'org' statement to make sure the code will be put where 
        you think it will.
        * Check the reset vector
Program the device
        * Make sure the oscillator settings are correct
        * Make sure the watchdog timer is turned off
        * Make sure that MCLR  is set the way you want
With the device in circuit
        * Is the oscillator oscillating?
        * Is MCLR is high, if you're using it

This should get you on your way.

Noel

invalid@invalid.com wrote:

> Hi all, > I'm really losing my mind now, been fighting with this for 8 days > now, I give up. I hope you can tell me what's wrong in my setup. :( > > I self made a PIC18F8720 development board, and it seems to work, > because I can program the chip with no problems. > > I'm using 100 nF SMD capacitors near every Vdd (including AVdd), > and an integrated clock oscillator. It's a 24 MHz CMOS part by > Epson. > > I wrote a simple test program which is supposed to set all ports > to output (via the TRISx registers), and then put all of them to > the "HIGH" logic level (via the PORTx registers). > > This is my code, as shown by IC-Prog: > 0000: D00F 0000 0000 0000 0000 0000 0000 0000 > 0008: 0000 0000 0000 0000 0000 0000 0000 0000 > 0010: 0000 0E00 6E92 6E93 6E94 6E95 6E96 6E97 > 0018: 6E98 6E99 6E9A 0000 0000 0000 0000 0000 > 0020: 0EFF 6E80 6E81 6E82 6E83 6E84 6E85 6E86 > 0028: 6E87 6E88 0000 0000 0000 0000 0000 0000 > 0030: D7DE 0000 0000 0000 0000 0000 0000 0000 > > And this is the configuration: > Config1 = 2500 > Config2 = 000F > Config3 = 0080 > Config4 = 0081 > Config5 = C0FF > Config6 = E0FF > Config7 = 40FF > ID Value = 0123456789ABCDEF > > Is there anything wrong in my machine code (for this quick test > I don't want to nor I think I need to install MP-Lab.. I tried > it and hated it, I will write my own source level debugger and > assembler and release it to the PD after I'm finished). > > Is the reset vector ok? It's supposed to be a BRA to 0010, where > it will meet a NOP (no reason in particular) and then the value > 00 will be moved to W, which in turn will be moved to all the > TRISx registers. Then W will be loaded with FF, which will be > copied to all the PORTx registers. Finally (through some NOPs, > again, just to leave some space for inserting other code for > experiments) there's supposed to be a final BRA back to 0010. > Addresses don't represent bytes, but instruction words. > > I know it's tedious to go through machine code.. but if you're > kind enough, and if the code or the configuration is wrong, please, > can you point me to the errors? > > Or, in alternative, could some kind soul post a small .HEX file > with a demo program that just turns some port pins ON and some > others OFF, just to see if my problem lies in my hardware or in > my code? > > I hope to get your valuable help.. I really don't know what to > experiment else. > > Kindest regards, > Mike Forrest
-- Noel's Lab www.noels-lab.com Chips, firmware, circuits and embedded systems
One more quick thing. How are you assembling the instructions? By hand? If 
so, look at gputils. They're open source tools for pic development and run 
under Linux and Windows. If you must have a gui, download the free mplab 
tools from Microchip.

Noel

Noel Henson wrote:

> Mike, > > Start small. Write the smallest program you can to turn on a single bit. I > recommend setting it low so you don't get confused by the internal > pullups. You can test with a 1K resistor and and LED. > > Write your small program. > * Check the 'org' statement to make sure the code will be put > where you think it will. > * Check the reset vector > Program the device > * Make sure the oscillator settings are correct > * Make sure the watchdog timer is turned off > * Make sure that MCLR is set the way you want > With the device in circuit > * Is the oscillator oscillating? > * Is MCLR is high, if you're using it > > This should get you on your way. > > Noel > > invalid@invalid.com wrote: > >> Hi all, >> I'm really losing my mind now, been fighting with this for 8 days >> now, I give up. I hope you can tell me what's wrong in my setup. :( >> >> I self made a PIC18F8720 development board, and it seems to work, >> because I can program the chip with no problems. >> >> I'm using 100 nF SMD capacitors near every Vdd (including AVdd), >> and an integrated clock oscillator. It's a 24 MHz CMOS part by >> Epson. >> >> I wrote a simple test program which is supposed to set all ports >> to output (via the TRISx registers), and then put all of them to >> the "HIGH" logic level (via the PORTx registers). >> >> This is my code, as shown by IC-Prog: >> 0000: D00F 0000 0000 0000 0000 0000 0000 0000 >> 0008: 0000 0000 0000 0000 0000 0000 0000 0000 >> 0010: 0000 0E00 6E92 6E93 6E94 6E95 6E96 6E97 >> 0018: 6E98 6E99 6E9A 0000 0000 0000 0000 0000 >> 0020: 0EFF 6E80 6E81 6E82 6E83 6E84 6E85 6E86 >> 0028: 6E87 6E88 0000 0000 0000 0000 0000 0000 >> 0030: D7DE 0000 0000 0000 0000 0000 0000 0000 >> >> And this is the configuration: >> Config1 = 2500 >> Config2 = 000F >> Config3 = 0080 >> Config4 = 0081 >> Config5 = C0FF >> Config6 = E0FF >> Config7 = 40FF >> ID Value = 0123456789ABCDEF >> >> Is there anything wrong in my machine code (for this quick test >> I don't want to nor I think I need to install MP-Lab.. I tried >> it and hated it, I will write my own source level debugger and >> assembler and release it to the PD after I'm finished). >> >> Is the reset vector ok? It's supposed to be a BRA to 0010, where >> it will meet a NOP (no reason in particular) and then the value >> 00 will be moved to W, which in turn will be moved to all the >> TRISx registers. Then W will be loaded with FF, which will be >> copied to all the PORTx registers. Finally (through some NOPs, >> again, just to leave some space for inserting other code for >> experiments) there's supposed to be a final BRA back to 0010. >> Addresses don't represent bytes, but instruction words. >> >> I know it's tedious to go through machine code.. but if you're >> kind enough, and if the code or the configuration is wrong, please, >> can you point me to the errors? >> >> Or, in alternative, could some kind soul post a small .HEX file >> with a demo program that just turns some port pins ON and some >> others OFF, just to see if my problem lies in my hardware or in >> my code? >> >> I hope to get your valuable help.. I really don't know what to >> experiment else. >> >> Kindest regards, >> Mike Forrest >
-- Noel's Lab www.noels-lab.com Chips, firmware, circuits and embedded systems
What's wrong is that you are not using reasonable development tools allowing
you to track your problem in less time than you spent on writing your
message.

<invalid@invalid.com> wrote in message
news:OLOXb.9470$FJ6.391726@twister1.libero.it...
> Hi all, > I'm really losing my mind now, been fighting with this for 8 days > now, I give up. I hope you can tell me what's wrong in my setup. :(
8 days!!! You need < 60 minutes to start using MPLAB IDE.
> Is there anything wrong in my machine code (for this quick test > I don't want to nor I think I need to install MP-Lab.. I tried > it and hated it, I will write my own source level debugger and > assembler and release it to the PD after I'm finished).
That's your choice... But then don't ask someone else to use MPLAB for debugging your project.
> What's wrong is that you are not using reasonable development tools allowing > you to track your problem in less time than you spent on writing your > message.
Exactly. I can't figure out why the hell anyone would be so stubborn as to waste 8 days of time on something trivial just because they decided not to use a tool that just works and that is free on top of it.
On Sun, 15 Feb 2004 18:20:30 GMT, invalid@invalid.com wrote:

>This is my code, as shown by IC-Prog: >0000: D00F 0000 0000 0000 0000 0000 0000 0000 >0008: 0000 0000 0000 0000 0000 0000 0000 0000 >0010: 0000 0E00 6E92 6E93 6E94 6E95 6E96 6E97
<snip> You seriously expect people to disassemble your code? Get real. I'm not really all that inclined to help people who just put obstacles in the way for no sensible reason.
>I don't want to nor I think I need to install MP-Lab.
Well, unless you're a truly dedicated masochist, you really need an assembler. What's so wrong with MPASM?
>it and hated it, I will write my own source level debugger and >assembler and release it to the PD after I'm finished).
Why? And why would anyone else want to use it, when the "official" versions work well, and are free, and can be trusted to accurately reflect the differences between chips. Replacing the IDE is one thing (and I'd agree it's somewhat clunky and primitive), but I can't see anything to be gained from re-inventing wheels like the assembler. And the very thought of having to write simulation DLLs for the numerous different variations of PICs gives me the screaming abdabs. Are you trying to atone for something really appalling you did in a past life or something? Personally, I'd rather eat glue. -- Max