Post Go back to editing

How to delay GPIO at boot for other parts chip enable?

Category: Software

Hi,

I would like to use the ADAU1452 GPIO to send a logic high to enable my DAC, ADC, amplifier, only after a certain delay on initial boot, say 500ms to allow all power rails to stabilize in order.

I suppose I can use the method below, but as I understand it, this will continue to write about 20,000 samples to memory all the time the program is running. It seems very crude.

Can anybody help me with a better way?

Thank you!

Simon



title edit
[edited by: ssashton at 12:10 PM (GMT -4) on 14 Oct 2024]
  • Hello ssashton,

    You don't necessarily need to use the delay module for this, indeed memory will be wasted for creating the delay line.

    You can use a timer to create a delay, 

    when do you want to start the timer (for 500ms), as soon as the program starts to run or after a particular condition is met? Since you said initial boot, I will consider, as soon as the program starts running. In 500ms (timing is adjustable) after the program starts running, the GPIO will flag a signal.

    I have a few projects where this block is used for delaying logic, but I can't quickly find one on my PC.

    You can build your logic around this module, I will try to find a relevant project in my archive or I will create one and send it to you soon.

    Regards,

    Harish

  • Hello again,

    I made this little example but I didn't run this since I don't have an eval board with me currently. I hope it will work. 

    when the timer is ON, it will output '0' for 24000 sample periods which is 500ms at 48KHz. once it's reached it will flag '1'.

    You can change the sample values given in the DC cell to modify the timing, if you want to wait for 5 seconds then give 240000 as a sample count.

    just realized that the wiki has the same example.

    Kindly do reply if you have any questions.

    Regards,

    Harish

  • Hello ssachton,

    Harish is exactly right. The timer module is what you should use. 

    I have this program written for the ADAU1467 eval board using GPIO24 that is not on the ADAU1452 but all the other details apply. 

    On this eval board the pin is pulled up. Here lies the problem when you look at this in great detail. What I am concerned about is what happens to the GPIO pin when power is first applied and when the program is loaded and then when the program runs. I do not have many options since the eval board has a pull up on it. Most pins will float high when power is applied before any registers are set. So it is often good to have a pin remain high and then just pull it low by the program. The problem I am seeing on the eval board is that the pin starts high. (there is an LED on the pin) Then when the program loads I see it go low for a quick second and then it goes back high for the period of time I have the timer set to and then it goes low as it should. 

    This may or may not be an issue for you. It might start the DAC or amplifier too early but it might not be a problem if it has its own delay. 

    So what I am saying is that you might have to play around with logic levels and watch it on a scope from power up to see if there are any glitches. It might work better to have a pull-down. Just be certain to set the GPIO to NOT have the internal pull up enabled if you experiment with pulling this down. 

    This is what I did and it is the same as what Harish did and the timer is the answer. 

    Here is my project although it is not for the 1452. It can easily be adapted. 

    ADAU1467 GPIO Signal when boot complete after delay.dspproj

    Dave T

  • Thank you, your replies were very helpful!

    I knew there must be a better way and I found the stopwatch block, but not the timer.

    Dave, thanks for the tip about the GPIO being high before the program loads. I'll keep an eye on that.

  • Hello ssashton,

    Here is where it is located:

    EDIT:

    OH! I just realized I read your response wrong. You earlier had found the stopwatch but not the timer. You were not saying you could not find the timer. Sorry about that. Now if others read this post they will know where to find it! Slight smile

    Dave T