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

Thread: Serial Rx Only

  1. #1
    Member capricorn one's Avatar
    Join Date
    Oct 2014
    Location
    Los Angeles
    Posts
    53

    Serial Rx Only

    Wondering if it's possible to use only the Rx or Tx pin of the Serial port ( specifically on pin 8, Serial3, of Teensy 3.1/3.2 ). I'm using the Audio adapter board which remaps the SPI mosi pin to pin 7, which is the Rx pin of Serial3. I would like to be able to still use the hardware Serial3 port though at the same time, with pin 8 as Serial3 Tx pin, and pin 7 as SPI Mosi pin. Anyone ever try this? I know it would be a low level io pin remapping, but just wondering if the hardware is capable of doing this at all. Thanks in advance!
    Last edited by capricorn one; 05-23-2016 at 12:07 AM.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,988
    Quote Originally Posted by capricorn one View Post
    I would like to be able to still use the hardware Serial3 port though at the same time, with pin 8 as Serial3 Tx pin, and pin 7 as SPI Mosi pin. Anyone ever try this?
    Yes. In fact, I did this just a couple weeks ago. Here's the working code:

    https://github.com/PaulStoffregen/SO...oller.ino#L176

    All you need to do is use Serial3.begin(baud) before SPI.setMOSI(7) & SD.begin(pin). Pins 7 and 8 get configured for Serial3. Then SD.begin() steals pin 7 for MOSI, but pin 8 continues to work as Serial3 transmit. Obviously you can't use Serial3 to receive like this, but you can send. That project uses Serial3 to send messages to a motor controller which vibrates a 20 foot tall structure.... to add dramatic effect to sounds played on little speakers.

  3. #3
    Member capricorn one's Avatar
    Join Date
    Oct 2014
    Location
    Los Angeles
    Posts
    53
    Awesome, thanks Paul!

    After some digging and rethinking, I realized I really need the Rx as well. Was about to look for some kind of SPI->UART converter chip, which I wanted to avoid, when I realized that just like the UART pins, a lot of the core functionality of the MK20DX is able to be remapped to different IO pins. So, unless I'm wrong, I think I can move the I2S0_MCLK from pin 11 (MK20 pin 51) to pin 28 (MK20 pin 53) according to the signal multiplexing page in the datasheet. This gives me back access to pin 7 for UART2_RX. I'm guessing you didn't do this on the audio adapter board because pin 28 is on the underside connections, not the standard header pins?

    Thanks for your help Paul!

Posting Permissions

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