Shop OBEX P1 Docs P2 Docs Learn Events
4Mhz Clock - Is the Prop up to it? — Parallax Forums

4Mhz Clock - Is the Prop up to it?

PhilldapillPhilldapill Posts: 1,283
edited 2008-12-10 03:16 in Propeller 1
I got some cool samples from TI the other day. They are TLV2543, 12-bit, 66KSPS, 11-ch, ADC chips. I'm building something that needs a lot of ADC's, but don't want to go the route of using the component·S-D ADC for the prop that it seems most people use. For one, it seems like it's too many components when you're talking 10 channels. Secondly, that's a lot of cogs and pins. This chip will only need 4 pins, and I get all 11 channels out of it. I'm sure there are better chips out there, but I want to do some learning and get an object working at top speed for it(or at least close to it).

Now, hardware and wiring aside, I'm wondering if the propeller can supply a fast enough clock to this chip. The datasheet states a typical clock of 3MHz, 4.1MHz maximum. Like I said, I'd like to get this thing sampling as fast as possible, but I'm worried spin isn't up to it. Should all the I/O be done in PASM instead? I'm fairly new to it, and would like to do spin if I can.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-16 18:17
    For this kind of communications speed, you will need assembly language.· The Prop should have no problem keeping up using assembly language.· What are you going to do with all that data?· It's not like there's a huge amount of buffer space even with 32K of RAM for the main (shared) memory.
    ·
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-07-16 19:33
    This is, again, for my maximum power point tracker. I need to measure voltages across capacitors and shunts. I would like to be able to simply use two of the channels in a differential measurement, but the voltages could be higher than the Vin- can support(about 1.25V). To do this, I will measure the voltage at one end of the cap, then measure the other end, and find the difference. I have 3 capacitors, and 2 shunts to measure, so 11 channels gives me 1 extra channel to spare.

    I was afraid of the need for PASM. This isn't a simple matter since there is alot of averaging and querying of the chip. Thanks Mike.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-07-16 19:43
    The ADC you refer to is fully static on the digital side. The clock is spec'd as zero to 4.1MHz, so there's no reason you couldn't access it with Spin. You won't get the maximum data rate, of course, but that may not matter.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-07-16 20:43
    Yes, Phil, I COULD use it with spin. I was hoping to get a higher sample rate, however. What do you mean by static on the digital side? Meaning it is completely controlled by the external processor, i.e. the propeller? I know some ADC's sample on their own and you have to sync with them to get the data.
  • TimmooreTimmoore Posts: 1,031
    edited 2008-07-16 21:05
    the ioclock rate says from 0 to 4Mhz so you can clock it at any rate upto 4Mhz, though there are some inconsistencies in the spec. The max clock is 4 Mhz but the min high and low clock pulse time is 190ns which makes the max clock 2.6Mhz. If you do it in asm you should be able to do a sample every 15us. 4.8us for clocking data in/out and 10us conversion time. You also will need to be careful in how you read, from clock low to read is 250ns so you need to read after you have output the next bit and se tthe clock high. i.e. do someting like clock low, get next bit, output bit, clock low, read bit and store, repeat 12 times, wait for EOC to go low and then high and repeat
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-07-16 21:14
    By "static", I mean that the digital side can hold it's state without a clock. The analog side, OTOH, because it uses a switched capacitor sampling technique, requires a constant clock, which the device itself provides. This particular device does the sampling and conversion asynchronously, without requiring an external clock. Some SAR-type ADCs (e.g. ADC0831) output each bit as it's converted and use the serial I/O clock to clock the SAR, so there's a minimum clock speed to gurarantee that the sampling capacitor doesn't discharge before the conversion/readout is complete.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • TubularTubular Posts: 4,656
    edited 2008-07-16 23:09
    I've been playing with the MCP3304 which may also work for you. Its available in DIP for $4ish and has similar specs (50 ksps, 13 bit, 8ch, 4 fully differential or 8 single ended).

    Chip already wrote an object for the MCP3208 in ASM (similar 8ch 12 bit single ended device). This puts out a 1MHz clock to achieve the 50ksps inputs and needs 3 wires (the Din and Dout are tied together)

    Good luck with your project
  • TimmooreTimmoore Posts: 1,031
    edited 2008-07-16 23:31
    Chips object uses the 1MHz clock for DAC not ADC. Also the MCP3208 clocks data in and out separately. the tlv2543 really needs separate data in and out since its clocks both at the same time (you can probably get round this if you run the adc slower since data in/out are on different clock edges).
  • TimmooreTimmoore Posts: 1,031
    edited 2008-07-23 21:57
    @Philldapill, Are you still interested in this chip?
    I had requested some samples of these as well. I got round to putting 1 on a breakout board and writing a driver for it.
    It uses a cog and samples all channels continously, creating a running average (7/8 of the previous + 1/8 of new sample) of all channels. I haven't done an exact calculation but it should be doing ~4000 samples per channel per sec. Seems to work well though getting the driver and chip in sync on reset was a pain (power up was easy)
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-07-23 22:04
    Timmoore, I sure am! I haven't had time to play with it lately as I have other projects going on. Is this driver for the tlv2543? If so, could I take a look and try the driver out? Thanks a bunch Timmoore!
  • TimmooreTimmoore Posts: 1,031
    edited 2008-07-23 22:12
    Here you go, adctest.spin is the test program, just loops through all channels (including the test channels) printing them to debug. tlv2543.spin is the driver.
    adctest.spin has the crystal set to 6Mhz so you probably need to change that.
    it has clk to prop pin 0, dataout from adc prop pin 1, datain to adc prop pin 2, eoc prop pin 3 and cs pin prop pin 5 but there easy to change.
    Its only just working so it probably·still has bugs.

    Edit: Updated the archive, tidied up the initialization code up and tightened up the conversion loops

    Tim


    Post Edited (Timmoore) : 7/24/2008 3:27:28 AM GMT
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-12-10 03:16
    Ok, so Tim, it's been a while, but can you give some pointers on how to get this to work? I want to change the pin arrangement, but don't know how...
Sign In or Register to comment.