Electronics > Projects, Designs, and Technical Stuff
Flashing STM32 with USART over audio
thesame:
--- Quote from: mark03 on August 14, 2020, 02:54:42 pm ---No matter how good the audio-serial converter is, I strongly doubt it would be error free over the tens of thousands of bits in a typical small program. It only takes a single bit error in your code to make it crash, right? so this seems like a bad idea.
--- End quote ---
I can think two sources of errors, level errors and timing errors.
STM32 bootloader tolerates 2.5% of baud rate deviation and I believe audio output sampling rate is far more stable than this. So the timing errors are out of scope.
The level stability totally depends on how reliably the transistor gets open/cutoff. That's why I'm asking the forum for help. From my perspective audio output voltage is enough for driving it but I'd love to hear from somebody if I'm wrong/right.
thesame:
I think I missed the base current limiting resistor. Could anyone give me a hint on how do I calculate R1 and R2? Schematic diagram is attached.
gcewing:
That's not going to work very well as you've drawn it, because the DC level will drift off if you get a run of bytes with unequal numbers of ones and zeros.
You might be able to fix the output side by connecting a diode with its cathode to the right side of C2 and its anode to ground, so that the DC level gets reset whenever it tries to dip below ground.
You'll have a similar problem on the input side. You could try eliminating C1 and just drive the MIC input directly (or maybe through a resistor to protect against damaging something). But if there is AC coupling in the sound card that won't help. In that case you might need some smarts in your decoding software to cope with a slowly changing DC level.
thesame:
--- Quote from: gcewing on August 15, 2020, 02:47:55 pm ---That's not going to work very well as you've drawn it, because the DC level will drift off if you get a run of bytes with unequal numbers of ones and zeros.
--- End quote ---
I found this issue too after asking other people and running simulations. Now I have this version of the schematic:
--- Quote from: gcewing on August 15, 2020, 02:47:55 pm ---You might be able to fix the output side by connecting a diode with its cathode to the right side of C2 and its anode to ground, so that the DC level gets reset whenever it tries to dip below ground.
--- End quote ---
Yeah, transistor base has bias of 0.5V by the divider R2:R3 now. I don't know if the diode could do any useful job here. I'd like to hear your opinion.
--- Quote from: gcewing on August 15, 2020, 02:47:55 pm ---You'll have a similar problem on the input side. You could try eliminating C1 and just drive the MIC input directly (or maybe through a resistor to protect against damaging something). But if there is AC coupling in the sound card that won't help. In that case you might need some smarts in your decoding software to cope with a slowly changing DC level.
--- End quote ---
This is what bothers me now. MIC input is 5V biased from the laptop side and I'd like not to connect it to 3.3V output directly. I'm trying to decouple this bias by the capacitor but I think it still suffers from DC drift over time. How can I eliminate it?
magic:
There is already AC coupling inside (almost?) every soundcard input, adding another AC coupling doesn't change much. The only solution to it is that your RX software has to ignore the DC level and look for rising and falling edges, wherever they are.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version