Created Mon, 30 Sep 2013 19:15:15 +0000 by ecolomato
Mon, 30 Sep 2013 19:15:15 +0000
I'm trying to synchronize my UNO32 or uC32 board to an external clock. I need to generate an interrupt every 128 or 256 external pulses, and I can't find the way. I'm trying to do it with timers but they can't count external pulses... TxCK pins are not available on that boards. What pins could I use for that function?
Mon, 30 Sep 2013 23:54:29 +0000
I can think of 3 ways to do this:
use an external interrupt pin and have interrupt count up.
Use an external binary counter to count down to 128 or 256 and then feed to an external interrupt pin. This requires more hardware but uses less CPU resources.
How I would do it as I am comfortable with a soldering iron. T1CK is on pin 48. Pin 48 goes to crystal X2 which is not installed so you can solder a pin into hole for crystal that is connected to pin 48 through a zero ohm resistor. You of course could not add the crystal.
Tue, 01 Oct 2013 06:08:52 +0000
I've been trying your 3rd option, but Timer1 count (TMR1) doesn't rise. Is the C22 capacitor attenuating my external clock signal? or Could I have forgotten setting any register? I've followed the example in the PIC32 reference manual Timers section: 16-bit Asynchronous counter mode (external clock). Should it be Asynchronous or Synchronous?
Tue, 01 Oct 2013 15:45:00 +0000
Personally I'd go for option 4 - use a PIC32MX1xx/2xx based board to drive the audio codec chip. Maybe something like the Fubarino Mini would do the job nicely.
Control it through SPI (maybe even stream audio through SPI).
Wed, 02 Oct 2013 12:16:36 +0000
Option 4 is also a good option, but does PIC32M1xx/2xx core runs at 80Mhz? I need that high speed for the rest of my code.
Now i'm working with SFR's, got to say that is better than working with libraries. That is the only way to know what to are exactly doing. And you can do it from MPIDE as well as MPLAB. I managed to synchronize UNO32 (master) with an audio codec (slave) connecting the codec MCLK out to the secondary oscilator crystal hole. The problem was configuration details, hard to realize using libraries... :?
Wed, 02 Oct 2013 14:01:25 +0000
No, sorry, it doesn't. There are two speed grades of the MX1/2 core - 40MHz and 50Mhz. The Fubarino Mini uses the 50MHz part.
You can overclock them, sometimes significantly though.