create an odd pattern of LED flashing and checking sample rates

Hi All,

I have an interesting little question, I have the following in a design for an ADAU1452

As you can see it simple flashes a "heartbeat" LED to show that the processor is alive with a cadence of 11000000. Can anyone think of a way that I can control the GPIO pin so the Cadence can be 10100000 or any other pattern that could be loaded to indicate various status? A typical logic design would just use an 8-bit shift register but I can't work out how to do it in SigmaStudio.

Another question:

Is there any way to compare the Core clock with the incoming clock on one of the SDATA input streams? This would be to determine the sample rate. The Core clock is always 12.288MHz but the incoming sample rate could be 48kHz or 96kHz and I would like to be able to determine which it is.

thanks for any help or suggestions

PhilipJ

  • +1
    •  Super User 
    on Oct 6, 2020 8:08 PM 1 month ago

         Hello Philip,

         You can make a pattern generator using the Bitwise AND function available in the ADAU1452.  As shown below, a 1 Hz clock and modulo-8 counter runs through eight rows of a Lookup Table, each loaded with a power-of-2 integer.  Bitwise ANDing this with the input number selects the appropriate bit for the LED.  I show a DC Source as the input, however it could come from anywhere in your project.  If the input exceeds integer 255, the circuit still blinks the LED according to the lowest eight bits.  You can easily expand this to more than eight bits if desired.  The attached project runs on the original revision EVAL-ADAU1452MINIZ board, that one routes MP6 to LED5 so I chose this MP pin.

        To measure an incoming audio sample rate --   If your I2S clock source can handle two loads, perhaps you could route it to another GP input and then use a circuit like the one shown here to measure its clock frequency.

         Best regards,

         Bob

    8-Bit-Pattern.zip

  • Hey KJBob, thanks that looks smart!! I've never really got to grips with LUT but with your example file it makes it so much easier to get something working.

    Great idea about putting the I2S clock into a GP pin - the hardware is already built for this project but I will certainly put it on the pile of good ideas for the next design we do...

    Many thanks for the help and advice

    PhilipJ