Skip to content

I2S Pio on kb2040 #1328

Closed Answered by WMXZ-EU
WMXZ-EU asked this question in Q&A
Mar 24, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

For sake of completeness, here is the code that is running on kb2040
`
pin_size_t _pinDOUT =0;
pin_size_t _pinBCLK =1;

int _freq=48000;
int _bps=32;
int off=0;

PIOProgram *_i2s;
PIO _pio;
int _sm;

#include "hardware/pio.h"

#define pio_i2s_in_wrap_target 0
#define pio_i2s_in_wrap 7

static const uint16_t pio_i2s_in_program_instructions[] = {
// .wrap_target
0xa022, // 0: mov x, y side 0
0x4801, // 1: in pins, 1 side 1
0x0041, // 2: jmp x--, 1 side 0
0x5801, // 3: in pins, 1 side 3
0xb022, // 4: mov x, y side 2
0x5801, // 5: in pins, 1 side 3
0x1045, // 6: jmp x--, 5 side 2
0x4801, // 7: in pins, 1 side 1
// .wrap
};

static const struct pio_program pio_i2s_in_program = {
.instructions = pio_…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@earlephilhower
Comment options

@WMXZ-EU
Comment options

Answer selected by WMXZ-EU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants