Using I2C as a Serial port?

Hi,

I'm using Teensy 3.2 and was wondering if I could utilize the I²C ports as simple RX/TX pins.

The reason I'm asking is because I am already using the 4 Serial ports (USB + Serials 1,2,3) the Teensy offers. I've read a little about SoftSerial and its alternatives but they all seem to be pin-specific, which is a bit of a problem for me (as you can tell I'm really using up those Teensy pins...).

I'd greatly appreciate your help.

I've read a little about SoftSerial and its alternatives but they all seem to be pin-specific

The whole point about SS is that you can use it on any pin. If you have 2 pins to spare I can't see why you can't use them with SS.

Graynomad:
The whole point about SS is that you can use it on any pin. If you have 2 pins to spare I can't see why you can't use them with SS.

This is correct for regular SoftwareSerial, but alternative libraries like AltSoftSerial are tied to specific pins.

Although not available just yet, the upcoming Teensy 3.5/3.6 come with 6 hardware serial ports, which may be an option if you can wait.

Ian.

That's a heck of a lot of UARTs - an uncommon use case indeed.

You can't use I2C ports as UARTs. Software serial (there are almost certainly multiple implementations of this available - there's probably something teensy-specific). You of course may be able to use a device that works over I2C to replace a device that needs a UART, depending on what you've got it talking to.

Can add I2C or SPI controlled UARTs to the design:
SC16IS752; SC16IS762
Dual UART with I2C-bus/SPI interface, 64 bytes of transmit
and receive FIFOs, IrDA SIR built-in support
http://www.nxp.com/search?client=nxp_search_all_results&site=nxp_en&proxystylesheet=nxp_search_style_fe&sort=date%3AD%3AL%3Ad1&oe=UTF-8&ie=UTF-8&ud=1&output=xml_no_dtd&exclude_apps=1&callback=ss_show&lang_cd=en&filter=0&getfields=*&baseUrl=http%3A%2F%2Fwww.nxp.com%2Fwebapp&SEARCH_OPERATOR=Contains&attempt=-1&rc=1&hl=en&dnavs=&q=SC16IS752
They used to carry a Quad part too, I can’t find it at their website now.

The Teensy 3.6 shows some stock, I guess it is overrun from his Kickstarter.

https://pjrc.com/store/teensy36.html

hmm... that page does not have a pinout or link to it.

A pinout is on the Kickstarter page

https://www.kickstarter.com/projects/paulstoffregen/teensy-35-and-36/description

I got a Teensy 3.5 but have not tried it yet.

Thanks for the replies, people.

Ordering the new Teensy (or the nxp board) is not an option or me at the moment, so I'm going to have to go with a software solution. I did give AltSoftwareSerial a try before, and it didn't work.

Haven't tried "NewSoftSerial", though, because I assumed since it doesn't have any of the I²C pins as optional RX, I have no use for it right now. The library that enables you to choose pin numbers more freely is called "SoftwareSerial" and its page on PJRC clearly states "DO NOT USE", sooo... should I use it? :stuck_out_tongue_closed_eyes:

Isn't there a Teensy forum? I would ask there what software serial implementation they recommend using on the teensy. Software serial implementations are specific to the hardware (software serial libraries that work across several architectures use #ifdefs to compile the right version of their code for the part you're building for), but it's seen as a "basic" functionality, so they'res probably something, we just don't know it here.

NonConformalMapping:
<…>
Haven’t tried “NewSoftSerial”, though, because I assumed since it doesn’t have any of the I²C pins as optional RX, I have no use for it right now. The library that enables you to choose pin numbers more freely is called “SoftwareSerial” and its page on PJRC clearly states “DO NOT USE”, sooo… should I use it? :stuck_out_tongue_closed_eyes:

“send only” and a “receive only” version of SoftwareSerial which will reduce your memory footprint unless you need full duplex comms. Of course, I do not know the difficulty associated with converting these for Teensy use.

Ray