Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

How do I monitor MISO/DRDY?

SPI

  • Please log in to reply
5 replies to this topic

#1 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 17 February 2013 - 05:53 AM

I've got the AD7789 ADC wired up to my board, and the crazy thing about this part (and some other ADCs) is that there is no separate DRDY pin, it's dual-functioned with MISO. I get "An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll", so obviously the compiler is complaining that I'm trying to declare the MISO pin as an InputPort as well.

 

I tried wiring MISO to a GPIO pin so I could monitor that, but it didn't work. What about Tristateport? I don't have much experience with them, so I don't know if that's the answer.



#2 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 17 February 2013 - 09:05 AM

I've got the AD7789 ADC wired up to my board, and the crazy thing about this part (and some other ADCs) is that there is no separate DRDY pin, it's dual-functioned with MISO. I get "An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll", so obviously the compiler is complaining that I'm trying to declare the MISO pin as an InputPort as well.

 

I tried wiring MISO to a GPIO pin so I could monitor that, but it didn't work. What about Tristateport? I don't have much experience with them, so I don't know if that's the answer.

I'd expect the exception to happen as you are trying to use the same pin twice.

 

Have you thought about feeding the DRDY signal to two pins - the MISO pin and another GPIO.  You can then detect the interrupt on the GPIO and then start the read process on SPI.  Not sure what electronic trickery you would need to put in place to ensure correct signal levels etc.

 

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#3 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 18 February 2013 - 12:52 AM

I'd expect the exception to happen as you are trying to use the same pin twice.

 

Have you thought about feeding the DRDY signal to two pins - the MISO pin and another GPIO.  You can then detect the interrupt on the GPIO and then start the read process on SPI.  Not sure what electronic trickery you would need to put in place to ensure correct signal levels etc.

 

Regards,

Mark

I tried that, but I had Port.ResistorMode.Disabled set. I'll try with pullup.

 

Edit: neither pullup nor pulldown worked.



#4 leiba

leiba

    New Member

  • Members
  • Pip
  • 1 posts

Posted 09 May 2013 - 11:29 PM

I also need to monitor the miso signal or control by time the CS before sending or receiving.

 

Is there no way to do this?

 

All I can think of is disposing the SPI every time before monitoring or controlling the signals, and then creating it again.

 

I read something about the Hardware Providers, but didn't understand. Does that help?

 

Thanks,



#5 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 10 May 2013 - 11:36 AM

Looking at the data sheet, it looks like you could monitor the RDY state by querying the status register.

 

The serial interface can operate in 3-wire mode by tying
CS
low.
In this case, the SCLK, DIN, and DOUT/
RDY
lines are used to
communicate with the AD7788/AD7789. The end of conversion
can be monitored using the
RDY
bit in the status register. This
scheme is suitable for interfacing to microcontrollers. If
CS
is
required as a decoding signal, it can be generated from a port
pin. For microcontroller interfaces, it is recommended that
SCLK idles high between data transfers.

 

The gist of this (if i am understanding the data sheet properly) is that you could connect the device as a standard SPI device, and then just read out from the status register the state of RDY.  Another option for the device would be to put the device into continuous read mode (power on default i belive) then it will just clock out the value of the ADC when you apply SCLK to the device...

 

Hope that helps

 

Nak.



#6 rockybooth

rockybooth

    Member

  • Members
  • PipPip
  • 16 posts

Posted 06 December 2013 - 01:13 AM

I was able to use leiba's suggestion of monitoring the conversion complete signal with this:

    Public Function ReadVolts() As Single        _spi.Dispose()        Dim cs As New OutputPort(_pin, False)        Dim adcout As New InputPort(Pins.GPIO_PIN_D12, False, Port.ResistorMode.Disabled)        While adcout.Read = True        End While        cs.Dispose()        adcout.Dispose()        SetupSPI()        Write7799Reg(&H58)        Return ReadAD7799Volts()    End Function

Has anyone had success with a different method?

Thanks

 







Also tagged with one or more of these keywords: SPI

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.