@@ -42,13 +42,13 @@ The :mod:`machine` module::
4242
4343 import machine
4444
45- machine.freq() # get the current frequency of the Core M4
46- machine.freq(CM4, freq) # set the frequency of the Core M4 sourced by PLL to freq. Value of freq can be upto 150 MHz
47- machine.freq(CM4_FLL, freq) # set the frequency of the Core M4 sourced by FLL to freq. Value of freq can be upto 48 MHz
48- machine.freq(AUDIO_I2S_98_MHZ) # set the frequency of the I2S clock to 98 MHz
49- machine.freq(AUDIO_I2S_90_MHZ) # set the frequency of the I2S clock to 90 MHz
50- machine.freq(AUDIO_PDM_24_576_000_HZ) # set the frequency of the I2S clock to 24576000 HZ
51- machine.freq(AUDIO_PDM_22_579_200_HZ) # set the frequency of the I2S clock to 22579200 HZ
45+ machine.freq() # get the current frequency of the Core M4
46+ machine.freq(machine. CM4, freq) # set the frequency of the Core M4 sourced by PLL to freq. Value of freq can be upto 150 MHz
47+ machine.freq(machine. CM4_FLL, freq) # set the frequency of the Core M4 sourced by FLL to freq. Value of freq can be upto 48 MHz
48+ machine.freq(machine. AUDIO_I2S_98_MHZ) # set the frequency of the I2S clock to 98 MHz
49+ machine.freq(machine. AUDIO_I2S_90_MHZ) # set the frequency of the I2S clock to 90 MHz
50+ machine.freq(machine. AUDIO_PDM_24_576_000_HZ) # set the frequency of the I2S clock to 24576000 HZ
51+ machine.freq(machine. AUDIO_PDM_22_579_200_HZ) # set the frequency of the I2S clock to 22579200 HZ
5252
5353Delay and timing
5454----------------
@@ -558,8 +558,8 @@ Before using the I2S bus, the I2S clock frequency needs to be set. The I2S clock
558558
559559::
560560
561- machine.freq(AUDIO_I2S_98_MHZ) # set the frequency of the I2S clock to 98 MHz. For sample rates: 8KHz / 16 KHz / 32 KHz / 48 KHz
562- machine.freq(AUDIO_I2S_90_MHZ) # set the frequency of the I2S clock to 90 MHz. For sample rates: 22.05 KHz / 44.1 KHz
561+ machine.freq(machine. AUDIO_I2S_98_MHZ) # set the frequency of the I2S clock to 98 MHz. For sample rates: 8KHz / 16 KHz / 32 KHz / 48 KHz
562+ machine.freq(machine. AUDIO_I2S_90_MHZ) # set the frequency of the I2S clock to 90 MHz. For sample rates: 22.05 KHz / 44.1 KHz
563563
564564Constructor
565565^^^^^^^^^^^^
@@ -581,15 +581,15 @@ Constructor
581581
582582::
583583
584- from machine import I2S, Pin
584+ from machine import I2S, Pin, AUDIO_I2S_90_MHZ
585585 import array
586+
586587 buf=bytearray(10) #Initialise buffer with required values for transmission & as empty buffer for reception
587588 machine.freq(AUDIO_I2S_90_MHZ) #set the frequency of the I2S clock to 90 MHz.
588589
589590 audio_out = I2S(0, sck="P13_1", ws="P13_2", sd="P13_3", mode=I2S.TX, bits=16, format=I2S.STEREO, rate=22050, ibuf=20000) #create I2S object
590591 num_written = audio_out.write(buf) # write buffer of audio samples to I2S device
591592
592-
593593 audio_in = I2S(0, sck="P5_4", ws="P5_5", sd="P5_6", mode=I2S.RX, bits=16, format=I2S.STEREO, rate=22050, ibuf=20000) # create I2S object
594594 num_read = audio_in.readinto(buf)# fill buffer with audio samples from I2S device
595595
@@ -609,14 +609,13 @@ Before using the PDM-PCM bus, the clock frequency needs to be set. The PDM-PCM c
609609
610610::
611611
612- machine.freq(AUDIO_PDM_24_576_000_HZ) # set the frequency of the clock to 24.576 MHz. For sample rates: 8 / 16 / 48 kHz
613- machine.freq(AUDIO_PDM_22_579_000_HZ) # set the frequency of the clock to 22.579 MHz. For sample rates: 22.05 / 44.1 KHz
612+ machine.freq(machine. AUDIO_PDM_24_576_000_HZ) # set the frequency of the clock to 24.576 MHz. For sample rates: 8 / 16 / 48 kHz
613+ machine.freq(machine. AUDIO_PDM_22_579_000_HZ) # set the frequency of the clock to 22.579 MHz. For sample rates: 22.05 / 44.1 KHz
614614
615615
616616PDM-PCM objects can be created and initialized using::
617617
618- from machine import PDM_PCM
619- from machine import Pin
618+ from machine import PDM_PCM, Pin, AUDIO_PDM_24_576_000_HZ
620619
621620 clk_pin = "P10_4"
622621 data_pin = "P10_5"
0 commit comments