Hot!SDI (MISO) Signal is weird

Author
douglashuang
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2018/11/06 00:42:19
  • Location: 0
  • Status: offline
2018/11/09 02:13:34 (permalink)
0

SDI (MISO) Signal is weird

I got a 6DOF IMU click (ST LSM6DS333) and put it in mikro bus B on MicroChip Explorer 16/32 Development Board. I tried to use SPI2 but read nothing. My software tool is MPLAB X IDE V5.05 and MPALB Code Configurator V3. The SPI speed is 1 MHz. I use my oscilloscope to get some photo. In Photo 1, Upper line is SCK and lower line is SDO (MOSI). Both signal are 3.3 V. However, In Photo 2, Upper line is SCK and lower line is SDI (MISO). The SDI signal is just below 0.5 V and the register SPI2BUFL is always 0. I could not read anything in the input. Photo 3 is my Pin module setting in MCC. Could anyone tell me what's wrong of my setting. Thank you very much.

Attached Image(s)

#1

9 Replies Related Threads

    concertinaman
    Bug Sorter
    • Total Posts : 245
    • Reward points : 0
    • Joined: 2007/06/14 05:56:58
    • Location: UK
    • Status: offline
    Re: SDI (MISO) Signal is weird 2018/11/09 02:23:38 (permalink)
    4 (2)
    Looks like SDO on the LSM6DS3 is high impedance and you are just seeing the clk signal coupled across.
    Check you are correctly driving the CS pin.
    #2
    Aussie Susan
    Super Member
    • Total Posts : 3399
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: SDI (MISO) Signal is weird 2018/11/11 18:11:12 (permalink)
    0
    Why are SCK and SDO pins marked as 'Analog'?
    Susan
    #3
    du00000001
    Just Some Member
    • Total Posts : 2352
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: SDI (MISO) Signal is weird 2018/11/11 19:06:02 (permalink)
    4 (2)
    @ Susan
    I've seen that too, but the Analog selection is only valid for inputs - being overridden by outputs. And SCK and SDO (plus /CS) are outputs.
     
    @ douglashuang
    Is VDD_IO connected? And are you sure you do not inadvertently operate the sensor in 3-wire mode?

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #4
    douglashuang
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2018/11/06 00:42:19
    • Location: 0
    • Status: offline
    Re: SDI (MISO) Signal is weird 2018/11/12 18:27:55 (permalink)
    0
    Dear all,
     
    Thanks for your help. I check my device by your suggestion but it's still not working.
     
    @concertinaman
     
    I have checked my CS pin and it drives low when SCK output. In photo 4, upper line(Channel 1) is SCK and lower line(Channel 2)  is CS (Sorry, it just has two channels).
     
    @du00000001
     
    I use click board on MicroChip Explorer 16/32 Development with PIC24FJ1024GB610. It is 4-wire interface mode. I have checked all output pins and they all work normally.  In Photo 5, upper line(Channel 1) is SCK and lower line(Channel 2) is SDO (MOSI). You can see two sets of SCK and the first for SDO, the second for SDI.

    Attached Image(s)

    #5
    davekw7x
    Entropy++
    • Total Posts : 1615
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: SDI (MISO) Signal is weird 2018/11/12 21:53:37 (permalink)
    0
    douglashuang
    ...mikro bus B ... Explorer 16/32 Development ... PIC24FJ1024GB610...



    Your MCC setup has the wrong pin assignments for this configuration.
     
    Here's the skinny:
     
    PIC24FJ1024GB610 PIM in Explorer 16/32
        mikroBUS SPI connections

    mikroBUS A     PIM Pin     CPU Port/Pin
    ---------------------------------------
    SCKA             10            RG6
    MISOA            11            RG7
    MOSIA            12            RG8
    CSA              14            RG9



    mikroBUS B     PIM Pin     CPU Port/Pin
    ---------------------------------------
    SCKB             55            RB0
    MISOB            54            RD2
    MOSIB            53            RF8
    CSB              23            RB2



    So...
    If you are using RG6, RG7, RG8 and RG9 on your PIC and your Click card is in mikroBUS B, MISO will not be driven.
     
    Bottom line: The second picture in your first post is consistent with the analysis by concertinaman (+1).  If you had given all of your information (namely the specific PIC/PIM device) in your first post someone might have caught it sooner.
     
    Regards,

    Dave
    post edited by davekw7x - 2018/11/12 22:50:02

    Sometimes I just can't help myself...
    #6
    douglashuang
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2018/11/06 00:42:19
    • Location: 0
    • Status: offline
    Re: SDI (MISO) Signal is weird 2018/11/12 23:21:17 (permalink)
    0
    Hi Dave,
     
    Thanks for your help. I have tried opening JP27 but it still got the same result. I try to use mikroBUS B (SPI1) but it seems can not worked in PIC24FJ1024GB610 PIM module (Pin_SPI1.png). If I want to use SPI interface, the only way is mikroBUS A (Pin_SPI2.png). I have tried everything for these two weeks. Anything wrong in my source code?
     
    BRs
     
    Douglas 

    Attached Image(s)

    #7
    davekw7x
    Entropy++
    • Total Posts : 1615
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: SDI (MISO) Signal is weird 2018/11/12 23:40:01 (permalink)
    4.67 (3)
    douglashuang
    ...I have tried opening JP27 but it still got the same result. I try to use mikroBUS B (SPI1) but it seems can not worked in PIC24FJ1024GB610 PIM module (Pin_SPI1.png)



    Sorry about my initial comment about JP27. It is irrelevant here.
     
    The thing is: Please look at my table.  (Better, yet, look at the schematics for the Explorer and the PIM.)  If you are going to use mikroBUS position B, you have the WRONG  (really, WRONG) pin assignments.  G6, G7, G8, and G9 are for mikroBUS position A.
     
    [Edit]
    Additional notes:
    Look at the PIM schematic and look at the Explorer schematic.  PGD and PGC to the PIM connector on the Explorer are at pins 26 and 27.  On the PIM you can see that they to go RB6/PGEC2 and RB7/PGED2.  Change those assignments also.  You can do it on the System Module "Easy Setup" window or on the Pin Manager "Grid View" window.
     
    Finally, in your code for reading and writing the SPI device you manipulate LATG9.  As I have mentioned (twice now) that is the wrong pin.  Just as important from a program debugging and  maintainability point of view, I think it would be better to use a name that you defined in the MCC Pin manager. In your first picture you called it Accel3_nCS.  I like it.
     
    I would set the "Custom name" for the correct chip select to that, then in the SPI read write functions, I would put

        Accel3_nCS_SetLow();
    .
    .
    .
        Accel3_nCS_SetHigh();

     
    Besides being more obvious, it makes it easy to change the pin if you want to use a different signal: Just change the assignment in the MCC pin manager, and you won't have to touch the application source code.
    [/Edit]
     
     
    Regards,

    Dave
    post edited by davekw7x - 2018/11/13 00:28:56

    Sometimes I just can't help myself...
    #8
    douglashuang
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2018/11/06 00:42:19
    • Location: 0
    • Status: offline
    Re: SDI (MISO) Signal is weird 2018/11/13 18:56:00 (permalink)
    0
    Dear All, 
     
    Thanks for your help. I swap another 6DOF IMU 2click (Bosch's BMI160) and it can work. Your suggestion is very valuable. Thanks again.
     
    BRs
     
    Douglas
    #9
    davekw7x
    Entropy++
    • Total Posts : 1615
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: SDI (MISO) Signal is weird 2018/11/13 21:02:03 (permalink)
    5 (5)
    I will not be allowed to post anything further for the next 48 hours.  The local seismological centre has informed me that the repeated tremors created by my banging my head against the wall is causing them to have to recalibrate their sensors.  (See Footnote.)
     
    Regards,
     
    Dave
     -30-
     
    Footnote:
    The opinions expressed here are not necessarily my own.
    It's these dang voices in my head...
    post edited by davekw7x - 2018/11/13 21:08:01

    Sometimes I just can't help myself...
    #10
    Jump to:
    © 2019 APG vNext Commercial Version 4.5