Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 12 of 12

Thread: Secondary Ports - T3.5

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    10

    Secondary Ports - T3.5

    I'm designing a PCB for a project for massive amounts of I/O for a T3.5 and was wondering about secondary ports. For instance, the pinout I have says D26 can be used as an alternate for TX1. Does that mean if I do Serial1.println("hi'); in my code, will D26 output a waveform by default?

    If not, how can I configure the Teensy to output on the alternate pins and not the primary pins?

    If so, how can I configure the Teensy to only output on the primary pins? For instance, if I have a device connected to the primary Serial1 pins but want to attach a servo signal wire to D26, what do I have to do to make sure I don't accidentally send a serial command to my PWM servo?

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,551
    Alternate pin usages are mutually exclusive.

    Each alternate usage has some specific way to make that transition for usage.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,064
    Quote Originally Posted by Power_Broker View Post
    For instance, the pinout I have says D26 can be used as an alternate for TX1. Does that mean if I do Serial1.println("hi'); in my code, will D26 output a waveform by default?
    The primary pins (letters in black) are used by default, if you do nothing special to choose the pin. Hopefully that's intuitive?

    To use the alternates, you need to add extra code to configure the pin. Hopefully that also makes sense, that the alternates would not normally be used until you do something special to select them?


    If not, how can I configure the Teensy to output on the alternate pins and not the primary pins?
    Serial1.setTX(pin). Details here:

    https://www.pjrc.com/teensy/td_uart.html


    If so, how can I configure the Teensy to only output on the primary pins?
    You can also use Serial1.setTX(1), though that's not necessary since the primary pins are used by default.


    For instance, if I have a device connected to the primary Serial1 pins but want to attach a servo signal wire to D26, what do I have to do to make sure I don't accidentally send a serial command to my PWM servo?
    While not an issue on pin 26 (since pin 1 is used by default), if you has the servo connected to pin 1, you would use Serial1.setTX(26) *before* Serial1.begin(), so that pin 26 is used from the very start of initializing Serial1.

  4. #4
    Junior Member
    Join Date
    Feb 2018
    Posts
    10
    Awesome! That clears things up a ton.

    I'm guessing I2C and SPI interfaces have something similar to .setTX(1)? i.e. .setCS(1) or .setSDA(1)?

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,551
    Quote Originally Posted by Power_Broker View Post
    Awesome! That clears things up a ton.

    I'm guessing I2C and SPI interfaces have something similar to .setTX(1)? i.e. .setCS(1) or .setSDA(1)?
    Yes as noted …

    Quote Originally Posted by defragster View Post
    ...
    Each alternate usage has some specific way to make that transition for usage.
    Sometimes in the constructor or .begin - other times there is a set

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,064
    Quote Originally Posted by Power_Broker View Post
    I'm guessing I2C and SPI interfaces have something similar to .setTX(1)? i.e. .setCS(1) or .setSDA(1)?
    They do indeed, and those functions are documented on the pages for those libraries.

    With SPI, the CS pins are normally controlled with digitalWrite() or digitalWriteFast().

  7. #7
    Junior Member
    Join Date
    Mar 2019
    Posts
    2
    Quote Originally Posted by PaulStoffregen View Post
    They do indeed, and those functions are silent dog grooming clippers for those libraries.

    With SPI, the CS pins are normally controlled with digitalWrite() or digitalWriteFast().
    It's clear to me now!

  8. #8
    Junior Member
    Join Date
    Apr 2017
    Location
    at home
    Posts
    11

    Wink

    Quote Originally Posted by PaulStoffregen View Post
    They do indeed, and those functions are documented on the pages for those libraries.

    With SPI, the CS pins are normally controlled with digitalWrite() or digitalWriteFast().
    which makes it as clear as MississippiMudPie for an old newby - where are these ?mythical? pages for those libraries - pretty please.
    I have wandered far and wide, in my quest for raw, lowdown, basic 'everybody knows that!' (which I don't). Yet w a y b a c k I started using Tiny C - which ISTR ran in 2k of ram after loading from a cassette player ... how are the mighty fallen or something, when a C compilation for teensy 'flash' takes a 2.4 ghz 8 core machine a measly 6 mins.
    P.S. just recovering from the lurgie, so my temper is not of the best - sorry. you have helped, but I would like to be able to help my self but the Hinterknet is a bit on the big size with lots of gash gen (rubbish). Mike

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,064
    SPI library:
    https://www.pjrc.com/teensy/td_libs_SPI.html

    Wire library:
    https://www.pjrc.com/teensy/td_libs_Wire.html


    when a C compilation for teensy 'flash' takes a 2.4 ghz 8 core machine a measly 6 mins.
    Maybe you're using Windows and you have a terrible anti-virus program that's massively slowing down filesystem access?

    On Macintosh and Linux, compile times are usually just a few seconds if you're previously compiled the same program, or 10-15 seconds if Arduino rebuild everything (like after changing any setting in the Tools menu).

    Windows is almost always slower, but not by more than about 2X. If you're seeing compile times measured in minutes, it's almost certainly anti-virus or malware interfering with disk access.

  10. #10
    Junior Member
    Join Date
    Apr 2017
    Location
    at home
    Posts
    11

    Smile

    Quote Originally Posted by PaulStoffregen View Post
    SPI library:
    https://www.pjrc.com/teensy/td_libs_SPI.html

    Wire library:
    https://www.pjrc.com/teensy/td_libs_Wire.html




    Maybe you're using Windows and you have a terrible anti-virus program that's massively slowing down filesystem access?

    On Macintosh and Linux, compile times are usually just a few seconds if you're previously compiled the same program, or 10-15 seconds if Arduino rebuild everything (like after changing any setting in the Tools menu).

    Windows is almost always slower, but not by more than aboutr whatever)
    OH Shuggar - I wrote a diatribe & windoze dumped it. - probably to the good.
    Yes I use Windoze Depender/defender/degrader or whatever - with no way I can see of stomping on it.
    and it is not helped by the huge multi kilobyte macro expansions - I'm surprised that W10(home) doesn't blow up like W3.11 did.
    And I am NOT unhappy with your answers - it just looks that way 'cos I'm no longer young and willing to trudge through treacle .
    (WAAAYY OFF topic - how to I kick Windoze Degrader into the bushes while I grind through Arduino (ug) interface. ( /Eclipse & /Amtel - have had issues with them as well).
    TIA Mike
    Last edited by emmbeabee; 04-03-2019 at 05:56 PM. Reason: windoze

  11. #11
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,551
    With the fear of RansomeWare attacking files - any app doing intense disk work is suspect and held up for some degree of monitoring. It was added to core Win 10 with recent releases in Windows Security/Defender, though it can be disabled and basically only monitors in 'USER" folders {docs,pics,destop}.

    It has been added to most other Antivirus like tools. With Defender and added Malwarebytes I had to set up exceptions for Malwarebytes to exclude the SSD area where I do all my Teensy/Arduino work.

    My 8 core i7 is finally completing rebuild uploads in under 5 seconds and not too much longer for full initial build.

    So back to line one - if Arduino was "installed" then it may be tied into USER folders enough to trigger extra watching. Doing UNZIP install to my isolated SSD drive keeps it clear of protected USER area - and not part of the 'Programs' directory and control area.


    As far as devices and libraries - they are documented - if not on PJRC.com in some fashion - then on Adafruit or SparkFun depending on the hardware in use and where acquired. When they are using the Primary pins for the BUS at hand then nothing special is required beyond proper wiring. Extended details for ALTernate pin usage depends on device and library at hand, when available or needed the above sources - or the library code interface will provide a way to specify the alternate pins.


    As far as LOST POST - the FORUM code saves text as entered on some schedule. So returning to the thread after restarting browser will show a 'Restore Content' {lower left corner of Quick Reply area} - though indeed most diatribes are best left unposted.

  12. #12
    Junior Member
    Join Date
    Apr 2017
    Location
    at home
    Posts
    11

    Smile

    Quote Originally Posted by defragster View Post
    With the fear of RansomeWare attacking files - any app doing intense disk work is suspect and held up for some degree of monitoring.
    ....
    So back to line one - if Arduino was "installed" then it may be tied into USER folders enough to trigger extra watching.
    YES each and every .ino (and 'ino.ino and .ino.ino.cpp - UH-) sits quite a distance down the User track. Thank You.
    [QUOTE] Doing UNZIP install to my isolated SSD drive keeps it clear of protected USER area - and not part of the 'Programs' directory a nd control area.
    HOKAY si I'll try a bit ot that - though doubt I can Isolate the ssd section of my HD,
    As far as devices and libraries - they are documented - if not on PJRC.com in some fashion - then on Adafruit or SparkFun depending on the hardware in use and where acquired. When they are using the Primary pins for the BUS at hand then nothing special is required beyond proper wiring. Extended details for ALTernate pin usage depends on device and library at hand, when available or needed the above sources - or the library code interface will provide a way to specify the alternate pins.
    ah - more knowledge TKU
    As far as LOST POST ...
    that is a quirk of my Hickup Pakhard I swurtcg the toutch pad off and it switches it back on again BUT I'll try the forum unsave when and if
    ..eft unposted.
    Yup.
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •