Speed Up Max1202
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
Thanks,
Greg
Comments
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.
Thanks
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
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 ###.
Although I can't sacrifice the resolution, I think it is a neat idea.
James L
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.
Thanks
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
You beat me to it.
I'll see you guys tomarrow, Duty calls!!!
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
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.
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
Good Luck with your project.
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!