Shop OBEX P1 Docs P2 Docs Learn Events
Speed Up Max1202 — Parallax Forums

Speed Up Max1202

steprogsteprog Posts: 227
edited 2007-02-02 14:05 in Propeller 1
Hello Everyone,· I am fairly green to the prop but in trying to use the MAX1202 ADC I noticed that the BS2 object doesn't like to be sped up any.· I'm hoping to max out the ADC but this serial stream is killing me.· Any advice?
Thanks,
Greg

Comments

  • bambinobambino Posts: 789
    edited 2007-01-29 18:13
    steprog,

    I have an assembly version running the 1270. Your welcome to it,but you will have tweak the routines little. It uses two cogs and pushes 17 clock conversions with a clock under 2Mhz. I slowed my app down some after testing it at those speeds. Right now its clocking 93Ksps.

    If your interested I'll clean it up a little for you.
  • steprogsteprog Posts: 227
    edited 2007-01-29 18:27
    Anything would be nice.
    Thanks
  • bambinobambino Posts: 789
    edited 2007-01-30 13:22
    I should have time·to zip it up for you tonight. I don't have internet at home, but I'll PM it to you tomarrow.
  • James LongJames Long Posts: 1,181
    edited 2007-01-30 15:41
    Greg,

    I'm sorry, the MAX 1202 object was the first thing I·wrote·for the Propeller. I didn't think about the SPI interface speed.

    I just used the default BS2 functions to communicate with it. You could find a faster SPI routine, and change the communication object.

    Hope this helps,

    James L
  • bambinobambino Posts: 789
    edited 2007-01-30 16:08
    James, Greg,

    A faster SPI routine would get you more speed, However the one I am using takes into account the fact that on reception of bit 6 from the max a new control code can be sent allowing for 18 bit conversions instead of 25. This means every 10th clock you are both sending and recieving on the next 6 clock cycles. The maximum samples per second is achieved with a slower clock basically.

    It does require that you make use of the strobe line, so if I/O is a problem you may want to consider some of the posted Fast SPI obj's. It also is not capable of going very slow either. Its either stop or haul ###.
  • James LongJames Long Posts: 1,181
    edited 2007-01-30 17:58
    That is an interesting spin (sorry about the pun) on the ADC code.

    Although I can't sacrifice the resolution, I think it is a neat idea.



    James L
  • bambinobambino Posts: 789
    edited 2007-01-30 18:06
    Nope,

    No loss. I get 12 bit same as always. It measures impact with a 500g accelorometer and 93Ksps is clear as a bell. Over that it is still clear up to 117 Ksps if your measuring something like a thermometer output but anything that changes fast it starts capturing droop on every other sample. I could probably go with 100Ksps with digital filtering but I don't need it.

    You can adjust the clock to get anywhere between 70Ksps to 117. Lower and it won't work because the cs line is held low continuously there is to much droop in the charge caps.
  • steprogsteprog Posts: 227
    edited 2007-01-30 18:09
    Thanks for the input guys.· Bambino I look forward to seeing your code.· According to James you sacrifice bits of resolution.· I haven't got that let.· James I will look to see if there is faster SPI objects out there.

    Thanks
  • James LongJames Long Posts: 1,181
    edited 2007-01-30 18:16
    Bambino,

    I'm sorry, I must have been confused by the 18 -25 thing. You are right.....the ADC is only 12 bit.

    But that is cool, but I have too many things happening to have such fast ADC checking. But thanks for the clarification, my mistake.....sorry.

    James L
  • bambinobambino Posts: 789
    edited 2007-01-30 18:16
    I am pretty sure the 1202 has this option, same as the 1270 I mean. If a control code is sent before bit 6 of the output then a new conversion is started, but after bit 6 is clocked out a new start bit can be recieved by the converter while the current conversion is in progress.
  • bambinobambino Posts: 789
    edited 2007-01-30 18:17
    A haa,

    You beat me to it.

    I'll see you guys tomarrow, Duty calls!!!
  • James LongJames Long Posts: 1,181
    edited 2007-01-30 18:21
    Bambino,

    By the datasheet it is bit 5.....so bit 6 should be fine.

    From the datasheet:

    If a falling edge on CS forces a start bit before B5
    becomes available, the current conversion is terminated
    and a new one started. Thus, the fastest the
    MAX1202/MAX1203 can run is 15 clocks/conversion.

    Jame L
  • bambinobambino Posts: 789
    edited 2007-01-31 13:20
    Ok, Here you go, but be warned. After taking out the trigger mechanisms and data conversions routines its pretty chopped up. You should get an idea how to start the converter and the rest is a matter of reading the ring buffer, which is probably larger than you need. If you shrink the buffer you will have to modify the end of files in the dat sections to keep the boundaries in check for the pointers.

    Just remember at this sped you keep cs low, no switching. So if I/O was a problem just tie it off and use the pin for the strobe. I've not tried that, but theoretically it should work.

    PS. It did compile, but without some calls to the output routines the PC terminal is not going to recieve data.
  • steprogsteprog Posts: 227
    edited 2007-02-01 21:09
    Hi Bambino,
    Thank you for the code.· I'm sorry it took me so long to reply.· I had some fires to put out.
    Thanks Again,
    Greg
  • bambinobambino Posts: 789
    edited 2007-02-01 21:24
    Your Welcome!



    Good Luck with your project.
  • Dennis FerronDennis Ferron Posts: 480
    edited 2007-02-02 02:41
    I'm interested in ADC for video processing (going in). On the LCD TV I just fixed, there are points where you can sample the R, G, B, and sync pulses from the video decoder chip. If I used three of these A/D converters to process this video signal (one each for R, G, and B), then according to my calculations 93Kbps would get me 6 pixels per line and in one second I would get 180 columns of horizontal resolution. Hmmm... one frame per second is not that great. Is there a way we could make this A/D stuff even faster?
  • bambinobambino Posts: 789
    edited 2007-02-02 14:05
    Dennis,

    The higest rate I got out at one time I thought was pretty close to 119Ksps, but because of the divisions on my scope I settled for calling it at 117. The layout I'm using right no is a bread board, with the 2 caps for reference, and one cap for a bypass. The manuel has some extra specs for caps to be used in noisy curcuits that I did not use, and of course PCB is better With ADC's than breadboards. If you could stand to loss the resolution I'm sure you could get higher. But for fast changing signals @ 12 bit resolution on the 1202,1270,1271's I think you are going to be topped off at 100Ksps using a PCB and more filter caps than I am currently using!
Sign In or Register to comment.