I plan on using Spark with 2 devices connected with serial at same time + default USB serial. On Arduino SoftwareSerial works perfectly for this purpose. Is this library ported for Spark?
Hi @ryotsuke Please see the discussion here on the same topic
It should be possible to implement a second UART as a supported library, but not a trivial task.
Not a trivial, but libraries like SoftwareSerial are used very often and are easy to use for end user, so I would be glad to see it on Spark supported lib list. So my question is about a simple for end user way of getting software serial port. That is suggestion for Spark’s TODO list )
No need for soft serial, there is a 2nd usable USART on the core, just needs software support to expose it to the user. See my post here: https://community.spark.io/t/how-to-implement-a-2nd-tx-rx-port-bugfix/1358/15?u=mattande
You mention that i2c is unavailable than. My project is expected to use serials, i2c, OneWire aaand 4 analog inputs, so things are complicated On Arduino I use SoftwareSerial working completely fine with i2c and everything else. Hope porting project to Spark with Wifi additionally enabled
You could use an I2C UART chip and add as many serial ports as you would like. (Well almost, there is a limit on the addressing.)
-or this one form Maxim, its a bit better since it has 128byte buffers versus 64bytes with the NXP products:
This is a very interesting solution, thanks. I’ll stick to it if software alternative will not be released
You could also make the same thing with an ATtiny 84/85 or even ATmega328P and 10 lines of Arduino Code.
I’ve done it with a 14 Pin MSP430G2543 and Energia in the past.
+1 for ATtiny85 I2C -> UART
The other chips are nice, but almost require a PCB with supporting components to get them up and running.
ATtiny85 would use an internal oscillator and be more or less dead simple. Maybe the only thing you’d have to add would be pull up resistors on the I2C bus, maybe…
At the end of the day though, Serial1 (and maybe Serial2) on the Spark Core should have a proper buffer and not be polled.
@ timb and BDub I agree with the ATtiny solution, if its a 1 off or prototype.
The UARTS are expensive when you consider the component itself and the crystal. If you are having a circuit made than the UARTS make more sense so you don’t have to worry about programming.
If you order over 100 Qty. Microchip offers free (or like penny) programming on quite a few variations of the PIC!
Seriously, cheap micro controllers make standalone devices like UARTs, GPIO Expanders and other like I/O devices nearly obsolete! (In fact, more and more of these purported “standalone” units are just ultra-budget uCs pre-programmed for a specific task and not dedicated silicon.)
@timb - sounds like a business opportunity for someone who can write bulletproof code for tiny micros. I would guess that there would be enough of a market that it could be worth it to have a few 100 programmed and sold through a small online store.