Smart Pins Docs and features

1111213141517»

Comments

  • evanhevanh Posts: 9,417
    edited 2019-10-20 - 02:09:54
    Hi Martin,
    This one I assume - https://forums.parallax.com/discussion/comment/1474859/#Comment_1474859
    That was a snippet from the testing code that evolved and morphed as the questions arose around general idea of using the streamers for burst copying externally. There wasn't any one form of the whole thing.

    The state it'll be in now will likely be a mess ... EDIT: Huh, or not. Looks like I left it as it was when I posted that snippet.

    EDIT2: And you'll need to use fastspin to assemble it without modification as I'm using #define and #include. I've noted minor changes with init-diag.spin2 that need this updated so here's an update to suit the newest init-diag.

    PS: First testing on revB silicon is incompatible. Will need some tuning ...
  • evanhevanh Posts: 9,417
    edited 2019-10-20 - 03:18:16
    Gee, the streamer config is too different. It's going to take more effort to make them compatible with common method. Those streamer operations haven't changed, just some config bits have moved over from the S operand to the D.

    EDIT: I don't want to have a common subroutine because that defeats the purpose of using assembly in timing critical ways.
  • @evanh

    Thank you for posting the code. I will study it.
    You explain this stuff well.
    Always a pleasure.


    Martin
  • fastspin meaning spin2gui?
  • fastspin can be used on its own as a command line tool. But if you are more comfortable with GUIs, by all means use flexgui (which is the new name for spin2gui), which includes fastspin as its default compiler.

    The latest version of flexgui is 4.0.2 and the binary release (flexgui.zip) is available at:

    https://patreon.com/totalspectrum
    or
    https://github.com/totalspectrum/flexgui/releases/latest
  • Yep, as Eric says.

    I've been quite happy with using a plain text editor, Kate, so I use fastspin directly. I have a one-liner shell command for fastspin+loadp2 that I reuse all the time.

    I must get this working with revB (v33), I was fiddling with the constants then got sidetracked ...

  • @evanh

    Thanks for posting the code.
    I am presently trying to get your lutson to work. What I am attempting to do is get the putch and getch to work in another program to
    just at first print a character.



    putch
    rqpin inb, #tx_pin wc 'transmiting? (C high == yes) *Needed to initiate tx
    testp #tx_pin wz 'buffer free? (IN high == yes)
    if_z_or_nc wypin char, #tx_pin 'write new byte to Y buffer
    if_z_or_nc ret wcz 'restore C/Z flags of calling routine
    jmp #putch 'wait while Smartpin is both full (nz) and transmitting (c)


    I have seen this snibbet a lot but can't get it to work. Do you have a simple example of it just printing a character to the serial terminal??
    Thanks
  • Ah, that HUBSET #0 at the beginning is for the FPGA rather than real silicon. It'll assemble fine, and even run, but the baud calculation isn't good enough so it garbles the emitted text in the terminal.

    Comment it out and uncomment the three lines below, ie:
    '+-------[ Set Xtal ]----------------------------------------------------------+ 
    '		hubset  #0                              ' set 20MHz+ mode
    		hubset  ##_SETFREQ                      ' setup oscillator
    		waitx   ##20_000_000/100                ' ~10ms
    		hubset  ##_ENAFREQ                      ' enable oscillator
    '+-----------------------------------------------------------------------------+
    
  • Actually, I used to leave the HUBSET #0 in place all the time ... which wasn't ideal because two consecutive clock setting operations without a pause creates extra unwanted turbulence in the PLL. Best not to do that.
  • Just a heads up on using INB as a dummy register.
    rqpin inb, #tx_pin wc 
    
    This works fine in normal operation but if used in a debug interrupt will clobber CZ states and the PC value.
    Just FYI.



  • evanhevanh Posts: 9,417
    edited 2019-11-10 - 00:37:58
    Good to know, I can probably use PA or PB in most cases. That's quite old code but those uses of INB are still there in current editions ... I'll try a clean up ... err, or not, that putch routine is already using PB, and PA is often a working scratch register in the next level up.

    Oh well, at this stage, I've never even looked at the debug ISR support and don't really have any plans to.
  • cgraceycgracey Posts: 12,793
    edited 2019-11-10 - 23:28:57
    ozpropdev wrote: »
    Just a heads up on using INB as a dummy register.
    rqpin inb, #tx_pin wc 
    
    This works fine in normal operation but if used in a debug interrupt will clobber CZ states and the PC value.
    Just FYI.



    Are you sure about that? I think I protected it from non-debug-mode writes. I will look.
  • Debug ISR is what Brian is referring to. He's basically saying I'm likely to fall foul of it at some point.

Sign In or Register to comment.