Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:37 10 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Just for Javavi to play with. I2S audio on the RP2350

Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10229
Posted: 03:38pm 20 Jan 2025
Copy link to clipboard 
Print this post

I said I wouldn't but then it looked like an interesting challenge

RP2350 only - uses PIO2
.program i2s
.side_set 2 ; BCLCK and WCLCK output (2 bits)

public entry:
.wrap_target ; wrap jump target
set x,30 side 0;
pull noblock side 1;
dataL:
out pins,1 side 0;
jmp x-- dataL side 1;

set x,30 side 2;
pull noblock side 3;
dataR:
out pins,1 side 2;
jmp x-- dataR side 3;
.wrap ; wrap jump to .wrap_target

Test version is standard PicoMite

PicoMite (2).zip

OPTION AUDIO I2S BCLKpin, DATApin

This reserves BCLKpin and BCLKpin+1 for the bit clock and word clock and Datapin for the I2S data. It requires an I2S DAC that can PLL the bitclock to create its own master clock

For example:
OPTION AUDIO I2S GP1,GP5
GP1 is the bit clock
GP2 is the word clock
GP5 is the data pin

All normal audio should work TONE, MP3, FLAC, WAV, MOD, SOUND

Note that you will see jitter on the BCLK. For the CPU at 150MHz the PIO needs to run at 44100*128 = 5644800 = 1/26.57 of the CPU clock speed. The way the H/W does this is to add or subtract clock ticks to the length of the PIO clock to give an average of 26.57 CPU ticks per PIO clock - hence jitter.




PLAY TONE 200,400


Edited 2025-01-21 02:20 by matherp
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 458
Posted: 04:21pm 20 Jan 2025
Copy link to clipboard 
Print this post

 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 458
Posted: 04:57pm 20 Jan 2025
Copy link to clipboard 
Print this post

Thank you very much, you made me happy!  [
My board with the soldered TDA1387T I2S DAC chip is now playing good music loudly!
And it doesn't matter whether the neighbors like it or not!
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 220
Posted: 08:57pm 25 Jan 2025
Copy link to clipboard 
Print this post

@javavi:

At what cpuspeed are you running the setup? I've just made a setup with a PCM1502 chip (seems to be the same board as Peter is using in the foto of his setup) on an Pimoroni RP2350-plus and encountered some strange effects:

at e.g. cpuspeed 252000 kHz and MP3 playback i get clicking noise and a "phasing-like" effect between left and right channel. Makes me dizzy with headphones and almost hurts my ears.  

at cpuspeed 206000 kHz the sound is audibly less distorted as far as i can tell. Minor fast clicks are audible though.

The clicking can also be reproduced with play tone command, but not the phasing effect. That appears only on mp3 playback.

Are there any restrictions to the mp3 compression used?

Is the TDA1387T showing the same effects? MMBasic Version is V6.00.02.b3
                                                                 
73 de OE1HGA, Gerald
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025