lu7did / ADX-rp2040

19 stars 4 forks source link

Avoid overflow on adc reads #6

Open mpmarks opened 1 year ago

mpmarks commented 1 year ago

Like you and je1rav I've modified an ADX design/board to use a Pico chip and support USB audio and CAT. I applaud your refactoring of the code and your valuable additions to it. I found that in the routine that reads the adc it accumulates 24 16 bit (realy 12 bit) adc values into a 16 bit accumulator. Depending on the incoming data this can easily cause an overflow resulting is crackles/distortion in the received audio. In my version I changed the accumulator to a 32 bit signed variable and also divided the result by 24 which has two effects. It does reduce the audio volume but the averaging also increases the effective bit resolution of the fairly poor Pico adc. In my case it improved the SNR quite a bit. I'm still experimenting with ways to reduce the impact of the CAT code on the audio stream. The serial traffic and delays cause extra noise and distortion on the received audio stream which interferes with the FT8 decoding somewhat.

p.s. I spent a week in BA earlier this year and really loved the city. 73 KV1D

lu7did commented 1 year ago

Hi Maurice, Actually the work between Hitoshi and myself is different as he's doing a general purpose transceiver and I'm working on a RF modem, and it's not a port as much of the code has been written from the ground up and not modifying an existing code. Nevertheless Hitoshi had provided very deeply useful insights on certain ways to address the USB connectivity which represented a breakthru in many respects.

Having say that and regarding your comment the ADC overflow it's possible but not likely because of the sampling rate and the (generally low) volume level present on the ADC input. Nevertheless I would appreciate if you submit a merge request with your changes (both the level and any improvement on the CAT). This project is absolutely open to ideas and modifications prooved to work and improve the design.

Cheers, 73 de Pedro, LU7DZ

PS: Thank you, I live part-time in the suburbs of BA and part-time in Mar del Plata some 400 Km south of it. Actually I visited a great deal of (countless) times your city when I worked for EDS and the HQ were located there (talking about one decade ago).