View Full Version : Speed Up Max1202
01-30-2007, 02:04 AM
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?
01-30-2007, 02:13 AM
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.
01-30-2007, 02:27 AM
Anything would be nice.
01-30-2007, 09:22 PM
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.
01-30-2007, 11:41 PM
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,
01-31-2007, 12:08 AM
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 ###.
01-31-2007, 01:58 AM
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.
01-31-2007, 02:06 AM
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.
01-31-2007, 02:09 AM
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.
01-31-2007, 02:16 AM
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.
01-31-2007, 02:16 AM
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.
01-31-2007, 02:17 AM
You beat me to it.
I'll see you guys tomarrow, Duty calls!!!
01-31-2007, 02:21 AM
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.
01-31-2007, 09:20 PM
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.
02-02-2007, 05:09 AM
Thank you for the code.· I'm sorry it took me so long to reply.· I had some fires to put out.
02-02-2007, 05:24 AM
Good Luck with your project.
02-02-2007, 10:41 AM
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?
02-02-2007, 10:05 PM
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!