- It is currently Fri May 20, 2022 6:58 pm • All times are UTC - 8 hours [ DST ]
[SOLVED]Audio codec shield with Arduino Due
Re: Audio codec shield with Arduino Due
I looked at the SS pin wave on the atmega in which case the shield was working. The SS pin was high for exactly 1 us and its freuency was 44 Khz. But in case of the Due that I am experimenting with the SS pin is high for 5us with a frequency of 66.67Khz.I think the SS pin timing is faulty and should be rectified. I do not know what to do.
- youthreewire
- Posts: 117
- Joined: Tue Jun 09, 2015 8:06 pm
Re: Audio codec shield with Arduino Due
the first thing to do is to get the right frequency. this is done by setting your clock divider to the right number. it should either be 127 or 128. then, you can set the pulse width by using direct port manipulation. i am assuming you are currently using digitalwrite(), and that you are writing 1, directly followed by 0. if this gives you 5us, you need to write to the pin faster, and direct manipulation using C and the port address is the fastest way of doing this. you will hae to look up online what the port variables are for the DUE. you will also have to place nop() between them to slow it down.
- guest
- Site Admin
- Posts: 449
- Joined: Thu May 20, 2010 11:58 pm
Re: Audio codec shield with Arduino Due
I managed to turn a pin at 45.454 Khz and I am able to complete the SPI.transfers at such frequency but still my SPI data reads zero.i need to give it a time period of 22.5 microseconds but I am able to delay only by 22 us. And that is why the pin is not toggling at exactly 44100 Khz. I might have to add _asm_(nop) but how many at 96 Mhz of the Due is not know to me.
- youthreewire
- Posts: 117
- Joined: Tue Jun 09, 2015 8:06 pm
Re: Audio codec shield with Arduino Due
The due is acting crazy. Some times the delayMicroseconds has an effect and some times it doesnt.
- youthreewire
- Posts: 117
- Joined: Tue Jun 09, 2015 8:06 pm
Who is online
Users browsing this forum: No registered users and 2 guests