Shop OBEX P1 Docs P2 Docs Learn Events
Help with shortest path cogs and pins wiring — Parallax Forums

Help with shortest path cogs and pins wiring

average joeaverage joe Posts: 795
edited 2012-04-18 01:34 in Propeller 1
I was reading in a post awhile ago about the connections between cogs and pins. There was some mention of the wiring but I can't seem to find it. I have done a few tests and determined my setup has an unsuitable noise floor using cog0 and pins 24 and 27 as output. I WILL be revising this but I do not have time before the expo. So, what I'm basically asking is this, which cog has the shortest wires to pins 24 and 27 so I can run Stereo Spatializer in this cog for now. Hopefully this will provide some improvement while working on the new hardware. Thanks again.
Joe

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2012-04-10 20:19
    After running some delay tests ([thread=127653]waitpxx cog synchronisation[/thread]) I'd say it's cog 7. This is supported by the latest datasheet 1.4 (8.5 Cog and I/O Pin Relationship). However, cog 7 is also closest to the XTAL h/w which AFAIAC [post=1036208]somehow affects audio generation[/post].
  • average joeaverage joe Posts: 795
    edited 2012-04-10 20:59
    Thank you so much kuroneko, that answers most of my questions. Your waitpxx cog synchronisation thread was the one I was thinking of, just couldn't remember what it was titled. That does explain why I was seeing more noise on p24. I was also unaware of crosstalk issues with adjacent pins. I will have to keep this in mind while working on future designs. From the quick tests I ran after reading this, it seems cog0 to cog5 have about the same noise on pins. Cog 6 is noisy, and 7 is worse by far.
    Great work as always and thanks again kuroneko!
  • average joeaverage joe Posts: 795
    edited 2012-04-16 20:20
    We have a new challenge! http://forums.parallax.com/showthread.php?137266-Propeller-GUI-touchscreen-and-full-color-display&p=1091205&viewfull=1#post1091205 This contains the schematic. We have pins 21, 23 for audio out. We will be planning board for analog out but considering provisions for spidif coax, which should be as simple from removing the cap from the circuit and possibly a voltage divider. Pin 20 is counter load, pin 22 is demux latch. I think these are the lowest frequency signals we can route here. I'm wondering best cog for pins 21,23 as well as what issues we may have with this pin config. Any help would be greatly appreciated!
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-04-16 20:33
    All these boards and they each use different pins. Thankfully most of the objects don't hard code the pins (though some do). Consider the PropBOE is now a primary reference design, and it uses pins 26 and 27. I wonder what cog is best for that? WAV generation sounds pretty good using cog1, no spatializing (though it does pop upon initialization). It's just Ray's basic 44.1K/16-bit ASM code, which I've been using as a baseline.

    Anyway, a plea from someone who has to explain this stuff to beginners: if you're not going with a "standardized" pin layout for audio out (consider PropBOE and Demo board the main reference designs), consider documenting the pin change requirements for the major sound-generating objects. Authors of these objects should be encouraged to not hard code the pin assignments throughout the program, but if that's not possible, then to fully comment those areas that need to be changed.

    No, I don't ask for much...

    -- Gordon
  • average joeaverage joe Posts: 795
    edited 2012-04-17 04:30
    Very true Gordon! I have not encountered an object that uses hard-coded pins in a while, but I hope everyone realizes why this is a no-no.
    I have not tried Ray's code yet since I've been working on other things. The only layout I've encountered that REALLY doesn't work is pin24 and cog7. I will be trying some experiments soon and will try out Ray's code. I wonder what the pop is, and what we could do to NIX it?
    It would be good to get a consensus which cog is best for pins 26 and 27 since that is the new "primary reference"
    I agree that documentation is very important and hard-coding should be avoided at all costs!
  • kuronekokuroneko Posts: 3,623
    edited 2012-04-17 06:25
    FWIW, 26/27 being pin group 3 I'd definitely avoid cog 7 and possibly cog 6 (see OR-chain schematic in the datasheet). Everything else should be fine. I wish we wouldn't have to worry about ID assignments ...
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-04-17 10:21
    IMPORTANT DISCLAIMER: I am using a pre-release PropBOE. The headphone amp circuit may have been, and probably was, changed by the time the final board was released. Mine is a build several months prior to final.

    The pop occurs when the cog is created, before any bytes are fetched from the SD card. It sounds a lot like the same kind of pop you get when you plug in a patch cord to an amp, which suggests an impedance issue. The (excellent, BTW) headphone amp circuit is hardwired in the PropBOE, so there's no changing it (if that's even needed). You can always directly attach a new circuit to the DAC pins for 26 and 27 should that be necessary, but as the headphone amp is still in-circuit, its input impedance needs to be factored in.

    JonnyMac's wavdacs demo pops, too, though not as loudly. But curiously, it's very noisy on *my* PropBOE -- you can hear it because the demo pauses at the start to ask if you want to play the clip. The might be due do its selection of cogs. I haven't yet looked closely at the program to follow what it does. My understanding is that its noise floor is supposed to be very low.

    All of the other WAV object examples pop, too. This includes Kwabena's and David Sloan's, though David's is not as objectionable (sadly, his object apparently misreads the higher bitrates and plays 44.1 kHz and 48 kHz files too slowly). Kwabena's also exhibits noise in the form of background hiss, the same as Jon's.

    I haven't yet played with WAV sound on other Propeller platforms, but it would be interesting to know if this is a general PropBOE issue, an issue just with the pre-release version I have, or is endemic to the way the objects work.

    -- Gordon
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-04-17 10:34
    On hard-coding the output pins: Ray's example actually does hard code in a few places. It's not hard to change. One is down in the assembly code. For my redo (for a magazine article) I've set these as constants, so the Propeller Tool should do the necessary substitution when compiling. His examples also hard-coded the SD basepin. On the PropBOE it's pin 22.

    In the case of Ray's stuff he's assuming a more experienced user, which is what these examples are for. But I think it's also a good idea to avoid hard-coding any pins, whenever possible, especially if the hard-coding is in the object itself, and not the demo program.

    Now, one could rightfully ask, why did they change the pins for the PropBOE? The pin assignments on the Demo board seem perfectly fine. The thing about the BOEs is that, by design, the first 16 pins are available for use to the breadboard. That means the special function pins need to be pin 16 and higher. So it all makes perfect sense, though it can cause consternation to people just discovering the Propeller, and using the PropBOE for trying out objects written for previous boards.

    I'm hoping there can be a selection of PropBOE-specific objects -- like a top 50 or something -- available on the learn.parallax.com site (or other location). I think that would reduce the frustration level for the newcomers.

    -- Gordon
  • Ahle2Ahle2 Posts: 1,179
    edited 2012-04-17 11:44
    The reason why ALL audio objects pops when they initialise are the same. And sadly It's not easy to do anything about.
    Before the sound object are started, the sound pins are floating and has got a "random voltage level" if nothing is connected.
    If something is connected (RC filter + amplifier), the voltage level will be whatever the "high impedance amplifier input" + capacitator + "air voltage" settles to.
    As soon as the objects starts it will force the voltage level to about 3.3V / 2 = 1.65V (DC offset) from whatever it was before in "about no time at all" and this will generate an irritating "all frequencies at once" pop.

    /Johannes
  • Ahle2Ahle2 Posts: 1,179
    edited 2012-04-17 11:56
    "... revising this but I do not have time before the expo"
    So did you have anything to demonstrate on the expo then?
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-04-17 14:20
    I'm wondering if some active switching on the DAC pins might help. Anyone tried something like that? You could keep the DAC output pin at that 1.65V offset voltage one cycle prior to the cog passing data through it.

    -- Gordon
  • kuronekokuroneko Posts: 3,623
    edited 2012-04-17 22:27
    Ahle2 wrote: »
    The reason why ALL audio objects pops when they initialise are the same. And sadly It's not easy to do anything about.
    Not perfect yet but it seems to take the edge of the pop. With force = TRUE and the code between the lines disabled (keep dira alive though) you'll hear two distinctive pops (the first one is intentional). With the sequence enabled the second transition becomes more like a blob. What it does is enabling/disabling dira with live counters (running idle, $8000_0000) PWM style starting with short periods of on-time. This sequence could be run inside the audio cog before it starts processing samples.
    ''
    '' Last modified: 2012/04/18
    ''
    CON
      _clkmode = XTAL1|PLL16X
      _xinfreq = 5_000_000
    
    CON
      AUDIO_R = 10
      AUDIO_L = 11
    
      range = 300
      force = TRUE
      
    PUB null
    
      if force
        dira[AUDIO_R]~~
        dira[AUDIO_L]~~
        waitcnt(clkfreq*2 + cnt)
        
      coginit(cogid, @entry, 0)
      
    DAT             org     0
    
    entry           movi    ctra, #%0_00110_000
                    movi    ctrb, #%0_00110_000
    
                    movs    ctra, #AUDIO_R
                    movs    ctrb, #AUDIO_L
    
                    movi    frqa, #%10000000_0      ' |
                    movi    frqb, #%10000000_0      ' $8000_0000
    '-----------------------------------------------
                    [COLOR="orange"]mov     eins, #range
    :primary        mov     zwei, #range[/color]
                    [COLOR="blue"]or      dira, mask              ' drive outputs[/COLOR]
    [COLOR="orange"]:secondary      cmp     zwei, eins wc
            if_b    andn    dira, mask
                    djnz    zwei, #:secondary
                    djnz    eins, #:primary[/COLOR]
    '-----------------------------------------------
                    movd    frqa, #%01_0000000      ' |
                    movd    frqb, #%01_0000000      ' $8001_0000, add something to listen to
    
                    waitpeq $, #0
                   
    ' initialised data and/or presets
    
    mask            long    |< AUDIO_R | |< AUDIO_L
    
    ' uninitialised data and/or temporaries
    
    eins            res     1
    zwei            res     1
    
                    fit
    
    DAT
    
  • TubularTubular Posts: 4,706
    edited 2012-04-17 23:37
    Just read this thread and came to same conclusion as Kuroneko - it should be possible to gradually go from a "random" voltage on the pin to a defined voltage over a period of time prior to the cog initialisation. So if the target is 1.65v, something like

    repeat 1000
    ..output high 'brief high pulse
    ..output low 'brief low pulse
    ..input (high impedance)
    ..decreasing delay ' perhaps an exponentially decreasing delay
    start audio cog
  • average joeaverage joe Posts: 795
    edited 2012-04-18 01:32
    Wow, once again you guys amaze me!
    @Ahle2, The Parallax guys were kind enough to provide me with some space INDOORS!! to give a few "side" demos of SidSynth, as well as a a bit of the screen work. There seemed to be some interest, although proper presentation materials would have helped. I was not quite as prepared as I would have liked. I had postulated the "floating pin" problem, but it's nice to have verification on that. I will try the workaround shortly.
    My other thought, would a "bleed" resistor help? Say 1M across gnd and audio out?
  • Ahle2Ahle2 Posts: 1,179
    edited 2012-04-18 01:34
    I was just about to write a proposed solution to the pop problem when I found the exact same solution already being proposed. :)

    @kuroneko and Tubular
    Great minds thinks alike!

    @average joe
    That was my other solution. A high resistance resistor between audio pin and gnd.
    Then gradually increase the duty voltage to the desired DC offset before starting synthesis or sample playback.

    /Johannes
Sign In or Register to comment.