So the OPNAcog VGM player (possibly with a different VGM file included, I don't remember what the other binary had. I hope it's obvious how to put in a different one).
If you comment out OPNA.setOPNARegister(i,buffer[1]) in line 72 it should be silent (but isn't...)
Also: HepTest. This is a player for a custom optimized audio compression format. This is of interest because it streams from the SD card, which is inherently quite noisy.
I included a silence.hep that's the windows xp boot chime and about 5 minutes of silence. Has to be on the SD card root. Once again, it should be obvious how to change it to a different file. You could create more HEP files with the encoder program, but here's some music I found in the couch (that hopefully still conforms to the latest format version ): https://mega.nz/file/PTIFxQyS#DHSw4XrUscWII2NHeE2f1mirCkjpYSXby9X3duGyHhQ
Compile both of these with flexspin, etc, etc.
(side note: I have no idea why I need volume = 0.18 in heptest. This would imply that the volume calculations in my other audio projects are off by a factor of 4 or 5? Though if it is, maybe that's a good thing, because none of my P2 boards actually have a volume control and I would like to keep my ears)
Upon reflection, it seems good analog is an important design feature of P2 and shouldn't be completely ignored here.
Guess I'll add LDO for A/V pins (VIO_8-11 and VIO-12-15) and maybe VIO_24-27 too, if there's room...
Anything where there's a static screen with no actual sound.
Even the P2-EC32 makes (too much of) digital noise on the audio output . I discovered this in the Basic interpreter while writing the audio system.
In this case the noise is mainly 50 Hz and all of its harmonics... because of the main loop that looks like this:
do
waitvbl
react to HID
loop
And the vbl ticks at 50 Hz
The same noise can be heared in the P2Play...It also is VBL driven, until it starts to read a directory. This takes much longer than vbl, so 50 Hz silences out and a high pitched noise is hearable instead, while reading and processing the directory. After that, 50 Hz returns.
If I had some sort of PCM recorder that isn't inherently noisy itself, it'd be interesting to compare different boards in terms of unwanted output while supposedly playing silence. IME recording the Edge and Eval on my PC's line-in there's a lot of noise that isn't there when connecting headphones directly. Not sure if that's because of low vs high impedance or if it's just interference traveling back up the USB cables and disturbing the cheap Realtek ADC. I guess a powered speaker (possibly snack food based) should reveal the difference.
Either way, the P2EVAL has no SD card interference when using headphones. With the HepTest.spin2/silence.hep above (remember to change the SD mount pins for non-rayslogic boards (ignore the SPI constants at the top they are just left over from P1 porting)), the SimpleP2 board is like brrrrrrrrrrrrrrt, can hear the compressed sectors streaming in at ~59Hz. P2EVAL still has it audible, but at a much lower level where it isn't really offensive. Don't remember if Edge is any better or worse, perhaps something to verify.
With the usual setup there's one VIO rails for an 8 pin group (though the chip VIO inputs at 4 pin granularity), so actually the whole video stuff is running off that. Seems to be a relatively minor issue though. ot a lot of video crosstalk. A good test for that is to run the "Grid" test pattern from 240p test suite (you can run the megadrive version on megayume. The neogeo version also works if you really want). That grid pattern sounds really awful if there's crosstalk. (I should probably make a native version of that pattern that takes less effort to set up...)
Ok, so maybe better plan is one LDO for pins 8-15 and another for pins 24-31. The second one covers the crystal, so maybe there's an advantage there...
@Wuerfel_21 Ok, tried your grid and can definitely hear it on headphones.
Much louder with my board, but all audio is louder with my board, that's another issue...
@Rayman said:
@Wuerfel_21 Ok, tried your grid and can definitely hear it on headphones.
Much louder with my board, but all audio is louder with my board, that's another issue...
Hmm, maybe I need to make a grid test with music to check relative level of video crosstalk.
If you try HepTest with one of the actual music files from the mega link, you should notice that SD crosstalk is a lot lower in level on P2EVAL relative to actual DAC output. (well, some of the files are so loud you can't really hear it, lol)
Also weird: with Grid, the noise gets quieter if you disconnect the monitor.
Also, going to squeeze in an electret mic. Not exactly clear how well that would work with P2 analog, but thinking it's OK.
There's still a header for an amplified one from Sparkfun if it doesn't work...
What's the 48_51 LDO for? These pins appear to be unused?
Anyways, if you're feeding the LDOs from the 5V rail directly, you can probably get rid of the 3.3V switcher and the strange noises it creates. You might be able to get away with 4 VIO rails total and have great separation of noise-sensitive parts:
Decided I don't want to mess with anything that NeoYume uses that isn't analog.
That has all been shown to work, something of great value.
Perhaps even more reliable with audio amp supply provided by LDO.
P48-P51 are for extra analog. Decided the analog features of the P2 should not be overlooked and want to provide some extra ripple free pins for general use.
A variant on that could be a 5 pin SOT23, OnSemi (NCP163 NCP164 NCP161 etc ) and TI (TPS7A20 TPS7A30 etc) have modern offerings there with sub 10uV noise, with good PSRR, and a generic pinout ?
If you are plagued by analog noise for audio, you could potentially move to digital audio if you have sufficient free pins. I did a proof of concept for i2s output using the old SNECog that Wuerfel_21 had ported to P2 and was able to get it to work some time back. https://forums.parallax.com/discussion/comment/1523033/#Comment_1523033
It used smartpins and didn't add too many additional instructions to an existing audio output loop and you can also retain analog out as well if you want. You can then use i2s DACs to generate the audio output, hopefully with a clean(er) power supply more isolated/filtered from the P2. @Wuerfel_21, do you have any plans for future digital audio output options in NeoYume?
@Rayman said:
Also, going to squeeze in an electret mic. Not exactly clear how well that would work with P2 analog, but thinking it's OK.
They work very well with audio. Audio contains no DC signal. The worst of the ADC internal noise is low frequency, which can be high-pass filtered with a simple inline cap.
@rogloh said:
If you are plagued by analog noise for audio, you could potentially move to digital audio if you have sufficient free pins. I did a proof of concept for i2s output using the old SNECog that Wuerfel_21 had ported to P2 and was able to get it to work some time back. https://forums.parallax.com/discussion/comment/1523033/#Comment_1523033
Good idea. i2s parts are quite good value for money, as the volumes are large.
If the added LDOs are still not enough, ( because you still have some common mode ground paths, the P2 GND path shares bonding wires, vias, and ground plane ) you could also look at differential Audio.
That needs two DAC pins driven in opposite directions.
I tthought about op amps (with their own power supply) and balanced output from 2 dacs to these op amps. A lot of digital/power supply noise may cancel itself this way.
@jmg Just looked around and the 5 pin parts do look better, but cost a lot more and have limited supply, at least on Digikey (not that I need a huge supply though).
I did see what looks to be a higher PSRR, more current, 3 pin part for 5 cents more: AP2210N-3.3TRG1DICT-ND
Another thing I kinda just noticed again: Your boards only work when I run loadp2 in terminal mode (and they reset when I quit that loadp2 terminal). I think this a linux issue with the serial port lines. The P2Eval (but not Edge/propplug) is immune to this issue, so mayhaps do what that does. But what is that?
Comments
I later figured out that I can just comment out the actual register writes and it still happens. hang on while I bundle up some sources
So the OPNAcog VGM player (possibly with a different VGM file included, I don't remember what the other binary had. I hope it's obvious how to put in a different one).
If you comment out
OPNA.setOPNARegister(i,buffer[1])
in line 72 it should be silent (but isn't...)Also: HepTest. This is a player for a custom optimized audio compression format. This is of interest because it streams from the SD card, which is inherently quite noisy.
I included a silence.hep that's the windows xp boot chime and about 5 minutes of silence. Has to be on the SD card root. Once again, it should be obvious how to change it to a different file. You could create more HEP files with the encoder program, but here's some music I found in the couch (that hopefully still conforms to the latest format version ): https://mega.nz/file/PTIFxQyS#DHSw4XrUscWII2NHeE2f1mirCkjpYSXby9X3duGyHhQ
Compile both of these with flexspin, etc, etc.
(side note: I have no idea why I need
volume = 0.18
in heptest. This would imply that the volume calculations in my other audio projects are off by a factor of 4 or 5? Though if it is, maybe that's a good thing, because none of my P2 boards actually have a volume control and I would like to keep my ears)If can’t figure a way to make it noise free, may have to reevaluate design goals….
Main goal was thermals good enough for NeoYume. Think we have that now.
Now have to think about how much I care about overclocked audio.
Might be easy to add ldo for vga and audio pin groups …
Upon reflection, it seems good analog is an important design feature of P2 and shouldn't be completely ignored here.
Guess I'll add LDO for A/V pins (VIO_8-11 and VIO-12-15) and maybe VIO_24-27 too, if there's room...
Even the P2-EC32 makes (too much of) digital noise on the audio output . I discovered this in the Basic interpreter while writing the audio system.
In this case the noise is mainly 50 Hz and all of its harmonics... because of the main loop that looks like this:
And the vbl ticks at 50 Hz
The same noise can be heared in the P2Play...It also is VBL driven, until it starts to read a directory. This takes much longer than vbl, so 50 Hz silences out and a high pitched noise is hearable instead, while reading and processing the directory. After that, 50 Hz returns.
If I had some sort of PCM recorder that isn't inherently noisy itself, it'd be interesting to compare different boards in terms of unwanted output while supposedly playing silence. IME recording the Edge and Eval on my PC's line-in there's a lot of noise that isn't there when connecting headphones directly. Not sure if that's because of low vs high impedance or if it's just interference traveling back up the USB cables and disturbing the cheap Realtek ADC. I guess a powered speaker (possibly snack food based) should reveal the difference.
Either way, the P2EVAL has no SD card interference when using headphones. With the HepTest.spin2/silence.hep above (remember to change the SD mount pins for non-rayslogic boards (ignore the SPI constants at the top they are just left over from P1 porting)), the SimpleP2 board is like brrrrrrrrrrrrrrt, can hear the compressed sectors streaming in at ~59Hz. P2EVAL still has it audible, but at a much lower level where it isn't really offensive. Don't remember if Edge is any better or worse, perhaps something to verify.
I think I'm seeing the VSync signal probably on the same LDO as the audio. Maybe that's the cause? You have 50 Hz video?
With the usual setup there's one VIO rails for an 8 pin group (though the chip VIO inputs at 4 pin granularity), so actually the whole video stuff is running off that. Seems to be a relatively minor issue though. ot a lot of video crosstalk. A good test for that is to run the "Grid" test pattern from 240p test suite (you can run the megadrive version on megayume. The neogeo version also works if you really want). That grid pattern sounds really awful if there's crosstalk. (I should probably make a native version of that pattern that takes less effort to set up...)
Here's a Spin2 version of a grid pattern. Can certify that it creates awful interference.
Ok, so maybe better plan is one LDO for pins 8-15 and another for pins 24-31. The second one covers the crystal, so maybe there's an advantage there...
@Wuerfel_21 Do you mean crosstalk between video and audio? So this VGA output makes noise on Eval board A/V audio?
And, this is due to sharing an ldo?
@Wuerfel_21 Ok, tried your grid and can definitely hear it on headphones.
Much louder with my board, but all audio is louder with my board, that's another issue...
Hmm, maybe I need to make a grid test with music to check relative level of video crosstalk.
If you try HepTest with one of the actual music files from the mega link, you should notice that SD crosstalk is a lot lower in level on P2EVAL relative to actual DAC output. (well, some of the files are so loud you can't really hear it, lol)
Also weird: with Grid, the noise gets quieter if you disconnect the monitor.
Grid with audio. SNR definitely worse than on EVAL.
Ok, maybe this is the plan then... Add three LDOs. Something like AP2120N
https://www.diodes.com/assets/Datasheets/AP2120.pdf
Also, going to squeeze in an electret mic. Not exactly clear how well that would work with P2 analog, but thinking it's OK.
There's still a header for an amplified one from Sparkfun if it doesn't work...
What's the 48_51 LDO for? These pins appear to be unused?
Anyways, if you're feeding the LDOs from the 5V rail directly, you can probably get rid of the 3.3V switcher and the strange noises it creates. You might be able to get away with 4 VIO rails total and have great separation of noise-sensitive parts:
Decided I don't want to mess with anything that NeoYume uses that isn't analog.
That has all been shown to work, something of great value.
Perhaps even more reliable with audio amp supply provided by LDO.
P48-P51 are for extra analog. Decided the analog features of the P2 should not be overlooked and want to provide some extra ripple free pins for general use.
You now have boards that work in fast mode reliably? (12 hours without crash etc)
Only one with new stencil but it’s at least an hour doing metal slug demo
A variant on that could be a 5 pin SOT23, OnSemi (NCP163 NCP164 NCP161 etc ) and TI (TPS7A20 TPS7A30 etc) have modern offerings there with sub 10uV noise, with good PSRR, and a generic pinout ?
Thanks @jmg I’ll take a look
If you are plagued by analog noise for audio, you could potentially move to digital audio if you have sufficient free pins. I did a proof of concept for i2s output using the old SNECog that Wuerfel_21 had ported to P2 and was able to get it to work some time back.
https://forums.parallax.com/discussion/comment/1523033/#Comment_1523033
It used smartpins and didn't add too many additional instructions to an existing audio output loop and you can also retain analog out as well if you want. You can then use i2s DACs to generate the audio output, hopefully with a clean(er) power supply more isolated/filtered from the P2. @Wuerfel_21, do you have any plans for future digital audio output options in NeoYume?
They work very well with audio. Audio contains no DC signal. The worst of the ADC internal noise is low frequency, which can be high-pass filtered with a simple inline cap.
Good idea. i2s parts are quite good value for money, as the volumes are large.
If the added LDOs are still not enough, ( because you still have some common mode ground paths, the P2 GND path shares bonding wires, vias, and ground plane ) you could also look at differential Audio.
That needs two DAC pins driven in opposite directions.
I tthought about op amps (with their own power supply) and balanced output from 2 dacs to these op amps. A lot of digital/power supply noise may cancel itself this way.
@jmg Just looked around and the 5 pin parts do look better, but cost a lot more and have limited supply, at least on Digikey (not that I need a huge supply though).
I did see what looks to be a higher PSRR, more current, 3 pin part for 5 cents more: AP2210N-3.3TRG1DICT-ND
Another thing I kinda just noticed again: Your boards only work when I run loadp2 in terminal mode (and they reset when I quit that loadp2 terminal). I think this a linux issue with the serial port lines. The P2Eval (but not Edge/propplug) is immune to this issue, so mayhaps do what that does. But what is that?
It appears the secret is to have a capacitor on there. The RevE PropPlug I have doesn't have one (but RevD did?????)