ADC gain: PGA setting test

master
unicod 2 weeks ago
parent b521217851
commit a2fb4a6af8

@ -444,6 +444,7 @@ int main(void)
int16_t ch = Uart5_GetByte(); int16_t ch = Uart5_GetByte();
if (ch != -1) { // if data received if (ch != -1) { // if data received
char c = ch; char c = ch;
static uint8_t PGA = 64;
if (c == 'a') { if (c == 'a') {
printf("I2S RX buf:\n"); printf("I2S RX buf:\n");
for (size_t i = 0; i < I2S2_RXDMA_BUF_SAMPLE_CNT; i++) { for (size_t i = 0; i < I2S2_RXDMA_BUF_SAMPLE_CNT; i++) {
@ -453,6 +454,22 @@ int main(void)
DumpI2SBufCnt = 512; // dump next 512 samples from I2S buffer in Proc_I2S_Buffer function DumpI2SBufCnt = 512; // dump next 512 samples from I2S buffer in Proc_I2S_Buffer function
} else if (c == 'd') { } else if (c == 'd') {
TLV320_AIC3204_DumpRegs(); TLV320_AIC3204_DumpRegs();
}else if (c == 'u') {
if (PGA < 127-8) {
PGA += 8;
TlvWriteReg(CODEC_A, TLV_PAGE_0, 15, PGA); // PGA_L
TlvWriteReg(CODEC_A, TLV_PAGE_0, 16, PGA); // PGA_R
printf("PGA: %u\n", PGA);
}
}else if (c == 'j') {
if (PGA >= 8) {
PGA -= 8;
TlvWriteReg(CODEC_A, TLV_PAGE_0, 15, PGA); // PGA_L
TlvWriteReg(CODEC_A, TLV_PAGE_0, 16, PGA); // PGA_R
printf("PGA: %u\n", PGA);
}
}else if (c == 'f') {
TlvWriteReg(CODEC_A, TLV_PAGE_0, 12, 0xF0); // Enable ADC high-pass filter
} }
if (isdigit(c)) { if (isdigit(c)) {
ChSel = c - '0'; ChSel = c - '0';

Loading…
Cancel
Save