• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Data Converters » Precision Data Converters » Precision Data Converters Forum » LMP90100 SPI Interface
Share
Precision Data Converters
  • Forum
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS
Check out
The Signal blog
  • $core_v2_blog.Current.Name

    Handy Gadgets and Resistor Divider Calculations

    Posted 7 days ago
    by Bruce Trump
    Handy gadgets make our engineering life easier—the little...
  • $core_v2_blog.Current.Name

    Chopper Op Amps—are they really noisy?

    Posted 15 days ago
    by Bruce Trump
    Chopper op amps offer very low offset voltage and dramatically...
  • $core_v2_blog.Current.Name

    Bypass Capacitors… yes, but why?

    Posted 27 days ago
    by Bruce Trump
    Everyone knows that op amps should have power supply bypass capacitors...

Forums

LMP90100 SPI Interface

This question is answered
Bradley Brooks
Posted by Bradley Brooks
on May 14 2012 16:13 PM
Prodigy105 points

I am having problems with SPI communications.  I have initialized my SPI inteface with cpol=0, cpha=1, MSB first, and 4-wire mode. 

Attached is a jpg file showing CSB, SCLK, MOSI, and MISO when trying to read CH0_CONFIG Register 0x21.

What am I doing wrong?

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Tom Hendrick
    Posted by Tom Hendrick
    on May 14 2012 19:26 PM
    Guru86200 points

    Hi Bradley,

    Your LA trace looks a little unusual - I'm not used to seeing the SCLK, MOSI and MISO all have what look to be the exact same set of data.  How are you connecting into the LMP90100?  Can you post us a schematic of your setup?

     

    Regards,

    Tom

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Bradley Brooks
    Posted by Bradley Brooks
    on May 23 2012 11:38 AM
    Prodigy105 points

    I did have a connection problem with my Microcontroller and LMP90100.  I have corrected that problem now and I am attempting to read CH0_CONFIG Register 0x21 from LMP90100 ADC and I should get the default value of 0x70, but I always get back zero.

    My LMPread function for register 0x21 sends Transaction-1 which is:  INSTR1, URA and then sends Transaction-2 which is INSTR2

        spiWrite(chr(INSTR1))                                            #sends 0x90
        spiWrite(chr(URA))                                                  #sends 0x02
        x = ord(spiXfer(chr(INSTR2)))                               #sends 0x81

    Attached is the updated LA trace.

    Is there something that I am missing because I only receive zero back when the default vaule for this register is suppose to be 0x70?  I have tried other registers whose default value is also non-zero with the same result of zero.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Bradley Brooks
    Posted by Bradley Brooks
    on May 24 2012 14:11 PM
    Prodigy105 points

    I am try to do a simple read and only receive back zero.  Do I need to write something before I can try a simple read?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishy Viswanathan
    Posted by Vishy Viswanathan
    on May 25 2012 11:59 AM
    Prodigy170 points

    Please take a look at the MSP430-LMP90100 interfacing application note and code zip for examples

    http://www.ti.com/lit/an/snaa134/snaa134.pdf 

    http://www.ti.com/litv/zip/snac029 <-- code zip

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • javier artigas paracuellos
    Posted by javier artigas paracuellos
    on Jul 06 2012 04:49 AM
    Prodigy100 points

    Hey.

    I have a similar problem. You gotta fix it?, You could tell me what you did?.

    Thank you.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Bradley Brooks
    Posted by Bradley Brooks
    on Jul 10 2012 10:07 AM
    Prodigy105 points

    I did have some problems with the SPI data I was trying to send to the ADC.  I now can send the correct SPI data, but still get no response from ADC.

    The logic analyzer attachment was created when I tried to follow the example on page 41 of the LMP90100 RevN Datasheet which is 17.4.2 Reading from Register Example.  That simple example would not even work correctly.

    address=34, 0x22
    INSTR1=16, 0x10
    URA=2, 0x02
    LRA=2, 0x02
    INSTR2=130, 0x82
    return value=0, 0x00

    I did not receive any support other than look at the example code which I already had done.  I think this ADC is a great product and I would love to get it working, but it took too long and no real support for it.  My solution was to use a different ADC (LTC2498).  If I can figure out what went wrong or get some support to find a solution, then I will post it here.

    Good luck, Javier!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishy Viswanathan
    Posted by Vishy Viswanathan
    on Jul 10 2012 16:03 PM
    Prodigy170 points

    Bradely/Javier,

    I attach here a scope shot for the register read transaction you mention above. The top waveform is CSB, then MISO, MOSI and CLK. If you look at the MOSI waveform, you can see first the instruction byte1 INSTR1 (0x10) is sent, followed by upper address byte URA (0x02) and instruction byte2 INSTR2 (0x82). Following this, we read the data byte on MISO (0x13) which is the default value for register 0x22. I used MSP430 USCIA1 (SPI mode) peripheral to control LMP90100. I also did a gpio bit bang version example (instead of using USCIA1 peripheral) and the scope shot is also attached below.

    Let me know if this helps. Please check if LMP90100 Evaluation Board is powered correctly. You need to provide two supplies (VA & VIO).

    Thanks,

    Vishy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishy Viswanathan
    Posted by Vishy Viswanathan
    on Jul 10 2012 16:10 PM
    Prodigy170 points

    I attach the scope shots below

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Bradley Brooks
    Posted by Bradley Brooks
    on Jul 12 2012 12:57 PM
    Prodigy105 points

    Vishy Viswanathan

    I also did a gpio bit bang version example (instead of using USCIA1 peripheral) and the scope shot is also attached below.

    Let me know if this helps. Please check if LMP90100 Evaluation Board is powered correctly. You need to provide two supplies (VA & VIO).

    Thanks,

    Vishy

    Vishy,

    I was using an 8-bit Atmel AVR micro-controller and separate board that I made for the LMP90100 (attached is picture of the LMP90100 board). 

    I have tried using both the built-in SPI interface (hardware) and wrote a gpio bit bang version (software).  With either the hardware or software SPI, I do not receive a response from LMP90100 (trying the example on page 41 of the LMP90100 RevN Datasheet which is 17.4.2 Reading from Register Example). 

    The steps you outlined in your explanation of the oscilloscope attachments, specifically:

    1) instruction byte1 INSTR1 (0x10) is sent

    2) followed by upper address byte URA (0x02)

    3) instruction byte2 INSTR2 (0x82)

    4) we read the data byte on MISO which should be (0x13) the default value for register 0x22

    are exactly what I have tried doing using both methods the hardware and software SPI.  Could you provide the code you wrote for your gpio bit bang version?  I don't know if it will help, but maybe there is something simple that I am missing. 

    Thanks,

    Brad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishy Viswanathan
    Posted by Vishy Viswanathan
    on Jul 12 2012 13:40 PM
    Prodigy170 points

    Brad,

    I attach here a zip file with the bitbang code. The file TI_MSP430_spi_BITBANG.c has all the functions you need to look at. There’s a SPI setup function to setup bitbang pins. There’s also SPI read and write functions that calls bitbang_in and bitbang_out to read and write out data. Let me know if you have questions.

    Thanks,

    Vishy4670.bitbang.zip

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Bradley Brooks
    Posted by Bradley Brooks
    on Jul 20 2012 22:00 PM
    Prodigy105 points

    Vishy,

    Since the bit-banged SPI software version is slower than the hardware SPI, I noticed on the logic analyzer capture the drdyb signal asserting about every 4.6ms. 

    Do I need to complete writing INST1, UAB, INST2 before the next assertion of drdyb, right? 

    Previously, I had not waited for drdyb to assert after asserting CS.  Using the hardware SPI, I have written INST1, UAB, INST2 before next drdyb, but I still get no response when trying to read from ADC. 

    What suggestions, if any, do you have for me to try?

    Thanks,

    Brad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishy Viswanathan
    Posted by Vishy Viswanathan
    on Jul 23 2012 20:38 PM
    Prodigy170 points

    Brad,

    drdyb matters when reading out of ADC_DOUT registers. There's no timing dependency for reading other registers with drdyb. Could you share with me your atmel bit bang code & also the schematic showing how the atmel MCU SPI (or GPIO) pins are setup?

    Thanks,

    Vishy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Bradley Brooks
    Posted by Bradley Brooks
    on Jul 23 2012 21:30 PM
    Prodigy105 points

    Vishy,

    Attached is Adobe PDF file with schematic and bit-bang code.   I am using an RF200 module from Synapse Wireless.  The microcontroller on the module is Atmel ATMega128RFA1. 

    I have also used the Synapse Wireless Forum (http://forums.synapse-wireless.com/showthread.php?t=2152&highlight=spi+communications+problems) to make sure I was using their version of Python to program the module correctly.  I have tried their built-in version of SPI and the attached code is my bit-bang implementation.  I think there must be something that I am missing when trying to read from the ADC.

    3034.TI Forum - Post.pdf

    Thanks,

    Brad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishy Viswanathan
    Posted by Vishy Viswanathan
    on Jul 24 2012 12:35 PM
    Prodigy170 points

    Brad,

    In your code, I see both the spiWriteReg and spiReadReg functions use SPI_MOSI line. Shouldn't the spiReadReg function use SPI_MISO line instead?

    >>> My bad: At the end I see you are using the MISO line.

    I am still reviewing. If I find something else, will let you know.

    thanks,

    Vishy

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishy Viswanathan
    Posted by Vishy Viswanathan
    on Jul 24 2012 17:58 PM
    Verified Answer
    Verified by Bradley Brooks
    Prodigy170 points

    Please see below my inputs after reviewing your python code:

    a)      In lmpSetupSPI(), please include

    SetPinDir(SPI_MISO, False)                     #just to be sure pin is configured as GPIO input

    b)      In SPIReadReg and SPIWriteReg, please try with clock polarity low to high instead of high to low (as in the bit bang code)

            writePin(SPI_SCK, False)                  # Toggle the clock line ( low to high polarity)

            writePin(SPI_SCK, True)                   # Toggle the clock line

    c)       SPIWriteReg: How is this function used? Not particularly useful as it won’t work with a lmp register address. At the end of SPIWriteReg why there is \CS toggle?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
12
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use