EmbeddedRelated.com
Forums

18F452 to SL811HS interfacing

Started by Tristan Mumford December 22, 2006
Hello.
I've been trying with limited success to interface a 18F452 uC to a SL811HS
USB host/slave IC.

I've pretty much debugged the software, but have hit a nasty brick wall in
hardware. I seem to be reading garbage from the IC. Ie no matter what
address I look at it's the same value. The really bothersome thing is the
omnipresent value changes every so often.

Is there anything I need in between these two chips? I'm using port D for
the databus and some of port C for the read, write and A0 lines.

The interface between the two is direct. Ie nothing in between. Should I
have something like a '245 or a network of pullups or something like that?
I didn't think I would considering the '811HS is 5v IO tolerant and the pins
on the PIC I'm using are schmitt triggers which should clean up the 3.3v IO
nicely.
I just feel like there's something I'm overlooking.
Any help would be appreciated.

If you are one of the rare individuals that actually follows links in
sigblocks, the code for the project on the site is useless. I've fixed many
idiotic mistakes since then.
-- 
-----> http://members.dodo.com.au/~izabellion1/tristan/index.html <-----
=====       It's not pretty, it's not great, but it is mine.       =====
Tristan Mumford wrote:
> Hello. > I've been trying with limited success to interface a 18F452 uC to a SL811HS > USB host/slave IC. > > I've pretty much debugged the software, but have hit a nasty brick wall in > hardware. I seem to be reading garbage from the IC. Ie no matter what > address I look at it's the same value. The really bothersome thing is the > omnipresent value changes every so often. > > Is there anything I need in between these two chips? I'm using port D for > the databus and some of port C for the read, write and A0 lines. > > The interface between the two is direct. Ie nothing in between. Should I > have something like a '245 or a network of pullups or something like that?
Please post a schematic.
> I didn't think I would considering the '811HS is 5v IO tolerant and the pins > on the PIC I'm using are schmitt triggers which should clean up the 3.3v IO > nicely. > I just feel like there's something I'm overlooking. > Any help would be appreciated. > > If you are one of the rare individuals that actually follows links in > sigblocks, the code for the project on the site is useless. I've fixed many > idiotic mistakes since then.
Donald wrote:

> Tristan Mumford wrote: >> Hello. >> I've been trying with limited success to interface a 18F452 uC to a >> SL811HS USB host/slave IC. >> >> I've pretty much debugged the software, but have hit a nasty brick wall >> in hardware. I seem to be reading garbage from the IC. Ie no matter what >> address I look at it's the same value. The really bothersome thing is the >> omnipresent value changes every so often. >> >> Is there anything I need in between these two chips? I'm using port D for >> the databus and some of port C for the read, write and A0 lines. >> >> The interface between the two is direct. Ie nothing in between. Should I >> have something like a '245 or a network of pullups or something like >> that? > > Please post a schematic. >
http://g.fondeville.free.fr/usb_en.html Let's just say that is it. After the original post I received an e-mail alerting me to the project. It was nearly identical to mine, so I rearranged a few IO lines to make it compatible (except the uC on mine runs at 8MHz). Then I changed a few "#define"s in my source to match. Amazingly enough my alterations didn't change anything for better or worse. Going from a feeling, it's like either D0 is stuck high, or the nWR line isn't working. I can't find a sign of either being the case though. Given that the value it regurgitates isn't changed even if I write a value to an address and read it back immediately the problem is a little hard to pin down. -- -----> http://members.dodo.com.au/~izabellion1/tristan/index.html <----- ===== It's not pretty, it's not great, but it is mine. =====
Tristan Mumford wrote:
> Donald wrote: > > >>Tristan Mumford wrote: >> >>>Hello. >>>I've been trying with limited success to interface a 18F452 uC to a >>>SL811HS USB host/slave IC. >>> >>>I've pretty much debugged the software, but have hit a nasty brick wall >>>in hardware. I seem to be reading garbage from the IC. Ie no matter what >>>address I look at it's the same value. The really bothersome thing is the >>>omnipresent value changes every so often. >>> >>>Is there anything I need in between these two chips? I'm using port D for >>>the databus and some of port C for the read, write and A0 lines. >>> >>>The interface between the two is direct. Ie nothing in between. Should I >>>have something like a '245 or a network of pullups or something like >>>that? >> >>Please post a schematic. >> > > http://g.fondeville.free.fr/usb_en.html >
So, you removed the '245 from your circuit ???
> Let's just say that is it. After the original post I received an e-mail > alerting me to the project. It was nearly identical to mine, so I > rearranged a few IO lines to make it compatible (except the uC on mine runs > at 8MHz). Then I changed a few "#define"s in my source to match. > Amazingly enough my alterations didn't change anything for better or worse. > > Going from a feeling, it's like either D0 is stuck high, or the nWR line > isn't working. I can't find a sign of either being the case though. > > Given that the value it regurgitates isn't changed even if I write a value > to an address and read it back immediately the problem is a little hard to > pin down.
Donald wrote:

> Tristan Mumford wrote: >> Donald wrote: >> >> >>>Tristan Mumford wrote: >>> >>>>Hello. >>>>I've been trying with limited success to interface a 18F452 uC to a >>>>SL811HS USB host/slave IC. >>>> >>>>I've pretty much debugged the software, but have hit a nasty brick wall >>>>in hardware. I seem to be reading garbage from the IC. Ie no matter what >>>>address I look at it's the same value. The really bothersome thing is >>>>the omnipresent value changes every so often. >>>> >>>>Is there anything I need in between these two chips? I'm using port D >>>>for the databus and some of port C for the read, write and A0 lines. >>>> >>>>The interface between the two is direct. Ie nothing in between. Should I >>>>have something like a '245 or a network of pullups or something like >>>>that? >>> >>>Please post a schematic. >>> >> >> http://g.fondeville.free.fr/usb_en.html >> > > So, you removed the '245 from your circuit ???
I never had one. I was asking if I should put one in. Sorry that my post lacked clarity. At any rate, last night I went through and checked again for open circuits and shorts. Couldn't find anything.
> > >> Let's just say that is it. After the original post I received an e-mail >> alerting me to the project. It was nearly identical to mine, so I >> rearranged a few IO lines to make it compatible (except the uC on mine >> runs at 8MHz). Then I changed a few "#define"s in my source to match. >> Amazingly enough my alterations didn't change anything for better or >> worse. >> >> Going from a feeling, it's like either D0 is stuck high, or the nWR line >> isn't working. I can't find a sign of either being the case though. >> >> Given that the value it regurgitates isn't changed even if I write a >> value to an address and read it back immediately the problem is a little >> hard to pin down.
-- -----> http://members.dodo.com.au/~izabellion1/tristan/index.html <----- ===== It's not pretty, it's not great, but it is mine. =====
Tristan Mumford wrote:


<snip>

Lets start over.

Is your circuit the same as the one on the schematic on:
http://g.fondeville.free.fr/usb_host_en.html

Is the timing of your circuit the same as:
http://g.fondeville.free.fr/usb_host_en.html


Is your code is C or assembly ?

Do you have a scope ?

Do you have an LED and  a 1K resistor ?

Have you written a monitor program to read and write I/O ports ?

Do you know for sure that the I/O ports are working ??

When you set port B for input, can you tell that each bit is working ?

When you set port B for output, can you tell that each bit is working ?


Take this in small steps.

If you don't have a scope, then an LED will work as well, just slower.


Good Luck

donald
Donald wrote:

> Tristan Mumford wrote: > > > <snip> > > Lets start over. > > Is your circuit the same as the one on the schematic on: > http://g.fondeville.free.fr/usb_host_en.html
Close enough. The differences are as follows: * I have larger power filter caps * The clock for the uC is derived from an external 7.881988MHz clock. * I don't have the LEDs or the pushbuttons. * There is a piezo for debugging feedback on otherwise unused pins. * My 3.3v rail regulator is different (but correct and tested).
> > Is the timing of your circuit the same as: > http://g.fondeville.free.fr/usb_host_en.html
Yes.
> > > Is your code is C or assembly ?
C. Using CCSC. It's more or less a port of the MicroUSB code (6502 asm).
> > Do you have a scope ?
Unfortunately not.
> > Do you have an LED and a 1K resistor ?
In abundance.
> > Have you written a monitor program to read and write I/O ports ?
Only to read and write preset values via my IO functions to the 811HS. Good idea. I'll make a generic one for testing all pins.
> > Do you know for sure that the I/O ports are working ??
The RS232 and the piezo function. I believe the /RESET line works also because resetting the SL811HS then gives a false reading of having a USB device detected, indicating the line is working.
> > When you set port B for input, can you tell that each bit is working ?
Port B? Haven't tried. Will check. Same for output.
> > When you set port B for output, can you tell that each bit is working ? > > > Take this in small steps. > > If you don't have a scope, then an LED will work as well, just slower.
thankyou for your help. I'll go over it a bit later. In the meantime, I'll knock up a monitor. Something to note is that earlier on in the project it was more sane. This was before I picked up on a few truly bizarre fabrication mistakes. Since then I've even replaced the SL811HS to be sure I didn't kill it. Even though my mistakes probably wouldn't have. Most notably one of the grounds of the 811HS going via a resistor. I hate to think how that happened.
> > > Good Luck
thanks, I need it. Tristan. -- -----> http://members.dodo.com.au/~izabellion1/tristan/index.html <----- ===== It's not pretty, it's not great, but it is mine. =====
Tristan Mumford wrote:
> Donald wrote: > > >>Tristan Mumford wrote: >> >> >><snip> >> >>Lets start over. >> >>Is your circuit the same as the one on the schematic on: >>http://g.fondeville.free.fr/usb_host_en.html > > > Close enough. The differences are as follows: > > * I have larger power filter caps > * The clock for the uC is derived from an external 7.881988MHz clock. > * I don't have the LEDs or the pushbuttons. > * There is a piezo for debugging feedback on otherwise unused pins. > * My 3.3v rail regulator is different (but correct and tested). > > >>Is the timing of your circuit the same as: >>http://g.fondeville.free.fr/usb_host_en.html > > > Yes. > > >> >>Is your code is C or assembly ? > > > C. Using CCSC. It's more or less a port of the MicroUSB code (6502 asm). > > >>Do you have a scope ? > > > Unfortunately not. > > >>Do you have an LED and a 1K resistor ? > > In abundance. > > >>Have you written a monitor program to read and write I/O ports ? > > > Only to read and write preset values via my IO functions to the 811HS. > Good idea. I'll make a generic one for testing all pins. > > > >>Do you know for sure that the I/O ports are working ?? > > > The RS232 and the piezo function. I believe the /RESET line works also > because resetting the SL811HS then gives a false reading of having a USB > device detected, indicating the line is working. > > >>When you set port B for input, can you tell that each bit is working ? > > Port B? Haven't tried. Will check. Same for output.
Opps, sorry its port D. I hope you are not using port D as a PSP (Parallel Slave Port). The PIC chips can _not_ input or output from this port programmaticly. Its only used by an _external_ device to access a configured PSP.
> >>When you set port B for output, can you tell that each bit is working ? >> >> >>Take this in small steps. >> >>If you don't have a scope, then an LED will work as well, just slower. > > > thankyou for your help. I'll go over it a bit later. In the meantime, I'll > knock up a monitor. > > Something to note is that earlier on in the project it was more sane. This > was before I picked up on a few truly bizarre fabrication mistakes. Since > then I've even replaced the SL811HS to be sure I didn't kill it. Even > though my mistakes probably wouldn't have. Most notably one of the grounds > of the 811HS going via a resistor. I hate to think how that happened. > > >> >>Good Luck > > > thanks, I need it. > > Tristan. >
Donald wrote:

> Tristan Mumford wrote:
>> Port B? Haven't tried. Will check. Same for output. > > Opps, sorry its port D. > > I hope you are not using port D as a PSP (Parallel Slave Port). > > The PIC chips can _not_ input or output from this port programmaticly. > Its only used by an _external_ device to access a configured PSP. >
Not in PSP mode. Checked that a couple of times. Been writing the monitor. Ran into one silly hitch. input(pin) only accepts constant pin numbers. CCSC is good for some things but a pain for others. -- -----> http://members.dodo.com.au/~izabellion1/tristan/index.html <----- ===== It's not pretty, it's not great, but it is mine. =====
Tristan Mumford wrote:

I know it's a self-reply. Just thought I'd say I've gone over it and the
source of the problem eludes me. Well, I know the source. It's sitting in
front of the PC right now.
I'm going to start from scratch with a different board layout (Still flying
lead style) with the '811HS on its own small daughterboard with support
circuitry. That way it's easier to debug and reuse for other experimental
projects.

I know there are better ways to do it but it's mostly for educational and
experimental purposes anyway.

Thankyou for your help. Unfortunately I can't really nail the problem with
my current equipment, so it's easier just to start again. It gives me an
opportunity to make some more additions anyway.

-- 
-----> http://members.dodo.com.au/~izabellion1/tristan/index.html <-----
=====       It's not pretty, it's not great, but it is mine.       =====