EmbeddedRelated.com
Forums
Memfault Beyond the Launch

SPI bus problems with PIC microcontroller

Started by sandeep April 17, 2007
Hello All,

I am using PIC18F6410 and interfacing it to Linear technology's
LTC2704 ( 16 bit DAC ).

I am checking the data signals on the SDO pin ( MOSI pin of the SPI
bus ) using a USB based Logic Analyzer.

When the pins of the Logic Analyzer are attached to the SDO pin, the
DAC is able to recognise the SPI command and acts accordingly, but
when I remove the logic analyzer connections, the DAC doesn't
recognise the SPI commands and acts like it is dead.

The voltage ouput on the pins of this logic analyser is about 1.157V
( between logic analyser pin and its GND pin).

Is there any fuse setting I am missing ? Is there any clock speeds
that I need to look into. I am running the PIC microcontroller at
20Mhz at present. Please help.

Thanks,

Sandeep

> I am using PIC18F6410 and interfacing it to Linear technology's > LTC2704 ( 16 bit DAC ). > > I am checking the data signals on the SDO pin ( MOSI pin of the SPI > bus ) using a USB based Logic Analyzer. > > When the pins of the Logic Analyzer are attached to the SDO pin, the > DAC is able to recognise the SPI command and acts accordingly, but > when I remove the logic analyzer connections, the DAC doesn't > recognise the SPI commands and acts like it is dead. > > The voltage ouput on the pins of this logic analyser is about 1.157V > ( between logic analyser pin and its GND pin). > > Is there any fuse setting I am missing ? Is there any clock speeds > that I need to look into. I am running the PIC microcontroller at > 20Mhz at present. Please help.
Maybe you have a voltage mis-match at the interface. Check the data sheets for voltage requirements. Maybe you have a line termination problem. Try using a pull up or pull down resistor. Try using a cap to simulate the logic probe. Then try to understand the differences. Maybe your DAC can't take clocks at the rate you're driving it. Check the data sheets for clock requirements. Try using a multichannel scope to look at the signals. A logic analyzer doesn't show you the situation in the analog domain. You might see overshoot, ringing, or slow edges that you can't see with a logic analyzer. JJS
On Apr 17, 3:19 pm, "John Speth" <johnsp...@yahoo.com> wrote:
> > I am using PIC18F6410 and interfacing it to Linear technology's > > LTC2704 ( 16 bit DAC ). > > > I am checking the data signals on the SDO pin ( MOSI pin of theSPI > >bus) using a USB based Logic Analyzer. > > > When the pins of the Logic Analyzer are attached to the SDO pin, the > > DAC is able to recognise theSPIcommand and acts accordingly, but > > when I remove the logic analyzer connections, the DAC doesn't > > recognise theSPIcommands and acts like it is dead. > > > The voltage ouput on the pins of this logic analyser is about 1.157V > > ( between logic analyser pin and its GND pin). > > > Is there any fuse setting I am missing ? Is there any clock speeds > > that I need to look into. I am running the PIC microcontroller at > > 20Mhz at present. Please help. > > Maybe you have a voltage mis-match at the interface. Check the data sheets > for voltage requirements. > > Maybe you have a line termination problem. Try using a pull up or pull down > resistor. Try using a cap to simulate the logic probe. Then try to > understand the differences. > > Maybe your DAC can't take clocks at the rate you're driving it. Check the > data sheets for clock requirements. > > Try using a multichannel scope to look at the signals. A logic analyzer > doesn't show you the situation in the analog domain. You might see > overshoot, ringing, or slow edges that you can't see with a logic analyzer. > > JJS
Thanks John. I will look into these and get back. Thanks for the pointers.
On Apr 17, 3:19 pm, "John Speth" <johnsp...@yahoo.com> wrote:
> > I am using PIC18F6410 and interfacing it to Linear technology's > > LTC2704 ( 16 bit DAC ). > > > I am checking the data signals on the SDO pin ( MOSI pin of theSPI > >bus) using a USB based Logic Analyzer. > > > When the pins of the Logic Analyzer are attached to the SDO pin, the > > DAC is able to recognise theSPIcommand and acts accordingly, but > > when I remove the logic analyzer connections, the DAC doesn't > > recognise theSPIcommands and acts like it is dead. > > > The voltage ouput on the pins of this logic analyser is about 1.157V > > ( between logic analyser pin and its GND pin). > > > Is there any fuse setting I am missing ? Is there any clock speeds > > that I need to look into. I am running the PIC microcontroller at > > 20Mhz at present. Please help. > > Maybe you have a voltage mis-match at the interface. Check the data sheets > for voltage requirements. > > Maybe you have a line termination problem. Try using a pull up or pull down > resistor. Try using a cap to simulate the logic probe. Then try to > understand the differences. > > Maybe your DAC can't take clocks at the rate you're driving it. Check the > data sheets for clock requirements. > > Try using a multichannel scope to look at the signals. A logic analyzer > doesn't show you the situation in the analog domain. You might see > overshoot, ringing, or slow edges that you can't see with a logic analyzer. > > JJS
Hello John, 1) I checked the Datasheets of the Microchip part and also for the DAC. I am running the PIC chip at 5V DC, and the DAC is running at +15V, -15V for analog and the digital supply is +5V. So I guess the digital voltage supply in both cases is +5V DC. 2) I also tried with many pull up resistors ( 10K, 4.7K and 2.1K ) --- no difference. The DAC doesnt recognise any commands on the SPI bus with fosc/16 as my SPI clock. 3) Then I tried pull down resistors ( 10K, and 4.7K ) and same result -- the DAC behaves " dead". 4) I tried clocking the SCK pins at different frequencies, like fosc/ 4, fosc/16 and fosc/64 and still no result. The DACs SCK frequency according to datasheets is 40Mhz max. My clock frequency ( fosc ) is just 20 Mhz. I generally run the SCk clock at fosc/16. I haven't tried with in-line series resistors and havent checked with the oscilloscope yet.
On Apr 17, 3:19 pm, "John Speth" <johnsp...@yahoo.com> wrote:
> > I am using PIC18F6410 and interfacing it to Linear technology's > > LTC2704 ( 16 bit DAC ). > > > I am checking the data signals on the SDO pin ( MOSI pin of the SPI > > bus ) using a USB based Logic Analyzer. > > > When the pins of the Logic Analyzer are attached to the SDO pin, the > > DAC is able to recognise the SPI command and acts accordingly, but > > when I remove the logic analyzer connections, the DAC doesn't > > recognise the SPI commands and acts like it is dead. > > > The voltage ouput on the pins of this logic analyser is about 1.157V > > ( between logic analyser pin and its GND pin). > > > Is there any fuse setting I am missing ? Is there any clock speeds > > that I need to look into. I am running the PIC microcontroller at > > 20Mhz at present. Please help. > > Maybe you have a voltage mis-match at the interface. Check the data sheets > for voltage requirements. > > Maybe you have a line termination problem. Try using a pull up or pull down > resistor. Try using a cap to simulate the logic probe. Then try to > understand the differences. > > Maybe your DAC can't take clocks at the rate you're driving it. Check the > data sheets for clock requirements. > > Try using a multichannel scope to look at the signals. A logic analyzer > doesn't show you the situation in the analog domain. You might see > overshoot, ringing, or slow edges that you can't see with a logic analyzer. > > JJS
Hello John, I put a 47 pF capacitor from SDO to GND, and it seems to be working now. I will run some extensive tests on it though. Thanks a lot. Sandeep
sandeep wrote:

> On Apr 17, 3:19 pm, "John Speth" <johnsp...@yahoo.com> wrote: > >>>I am using PIC18F6410 and interfacing it to Linear technology's >>>LTC2704 ( 16 bit DAC ). >> >>>I am checking the data signals on the SDO pin ( MOSI pin of theSPI >>>bus) using a USB based Logic Analyzer. >> >>>When the pins of the Logic Analyzer are attached to the SDO pin, the >>>DAC is able to recognise theSPIcommand and acts accordingly, but >>>when I remove the logic analyzer connections, the DAC doesn't >>>recognise theSPIcommands and acts like it is dead. >> >>>The voltage ouput on the pins of this logic analyser is about 1.157V >>>( between logic analyser pin and its GND pin). >> >>>Is there any fuse setting I am missing ? Is there any clock speeds >>>that I need to look into. I am running the PIC microcontroller at >>>20Mhz at present. Please help. >> >>Maybe you have a voltage mis-match at the interface. Check the data sheets >>for voltage requirements. >> >>Maybe you have a line termination problem. Try using a pull up or pull down >>resistor. Try using a cap to simulate the logic probe. Then try to >>understand the differences. >> >>Maybe your DAC can't take clocks at the rate you're driving it. Check the >>data sheets for clock requirements. >> >>Try using a multichannel scope to look at the signals. A logic analyzer >>doesn't show you the situation in the analog domain. You might see >>overshoot, ringing, or slow edges that you can't see with a logic analyzer. >> >>JJS > > > Hello John, > > 1) I checked the Datasheets of the Microchip part and also for the > DAC. I am running the PIC chip at 5V DC, and the DAC is running at > +15V, -15V for analog and the digital supply is +5V. So I guess the > digital voltage supply in both cases is +5V DC. > > 2) I also tried with many pull up resistors ( 10K, 4.7K and 2.1K ) --- > no difference. The DAC doesnt recognise any commands on the SPI bus > with fosc/16 as my SPI clock. > > 3) Then I tried pull down resistors ( 10K, and 4.7K ) and same result > -- the DAC behaves " dead". > > 4) I tried clocking the SCK pins at different frequencies, like fosc/ > 4, fosc/16 and fosc/64 and still no result. The DACs SCK frequency > according to datasheets is 40Mhz max. My clock frequency ( fosc ) is > just 20 Mhz. I generally run the SCk clock at fosc/16. > > I haven't tried with in-line series resistors and havent checked with > the oscilloscope yet.
when you makes these changes, does the attached-analyser, still give a working system ? When you say SDO, do you mean from the DAC, or the SDO from uC to SDI on the DAC [MOSI] ? SDO from the DAC should pretty much be "don't care", but a probe-fix on SDI into the DAC, could indicate the wrong phase settings on the SPI config. -jg
"Jim Granville" <no.spam@designtools.maps.co.nz> wrote in message 
news:46254ebf$1@clear.net.nz...
> sandeep wrote: > >> On Apr 17, 3:19 pm, "John Speth" <johnsp...@yahoo.com> wrote: >>
[snip]
> When you say SDO, do you mean from the DAC, or the SDO from uC to SDI on > the DAC [MOSI] ? > SDO from the DAC should pretty much be "don't care", but a > probe-fix on SDI into the DAC, could indicate the > wrong phase settings on the SPI config.
I concur with Jim here that the SPI clock is probably set up the wrong way (phase). That would mean that the data changes on the active clock edge, giving 0ns (nominal) hold time. Adding a capacitor (such as the probe) will delay the data enough to *appear* to work but will be a nightmare in production (temp, speed, batch variations). If clock phasing is the problem then that is what needs fixing, not loading output pins. Peter

Memfault Beyond the Launch