Version of Core with multiple USARTs broken out?

Hello all,

I just stumbled upon this platform a few days ago and I’m evaluating it for use in our product.
The one thing that could be a show stopper or only having access to 1 USART port. Our product at the moment really needs two USART ports as we don’t want to use a digital/analog multiplexer.

Will a version of the Core be made that breaks out another USART to another set of TX/RX pins?

Or, any ideas how to accomplish this without another USART port, and I’m not a fan of bit banging…

Thanks,
Jim

Theres are more than 1 hardware UART on the spark core and can be implemented by firmware changes.

But im not sure of the progress as of now

1 Like

Yup. If I remember correctly the I2C pins can be repurposed for UART duty. In fact, if you could get access to two timers you could make a highly reliable software UART as well.

Another option is to get a cheap $0.15 micro (like a PIC or MSP430) and make a Serial to I2C bridge. I’ve actually got this going with the 430 and it works brilliantly up to 115kbps.

1 Like

Cheapest I see among PIC, ATTINY and MSP430 is about 35 cents. What’s your source for a 15 cent micro??

Oh, I’ve seen TI do .20~ on 1xxx and G2 series at 5k (might have been 10k) quantity. This was a couple of years ago, but I’m sure they still work deals.

Anyway, there are .05, .10 and .15 cent MCUs out there, you’ve just got to know where to look. What do you think they put in your electric toothbrush and universal remote? :wink:

Give me a bit and I’ll get you a couple of links. There’s a whole world off cheap off-brand micros out there!

@notronrj Here is the Pinout

What baud rates and hand shake lines do you need do you need?

Hi, I’m looking for 8N1 9600 baud and don’t need hardware flow control. However if the pins for rx/TX are available shouldn’t the firmware / libraries be able to be updated to use them as Serial2 just as the first uart is supported in software?

The idea of using a small chip to cobble a second serial port together is interesting but seems less than optimal.

Are plans being made to support the second uart in the firmware?

Thanks everybody! !

@notronrj the link i showed you in the earlier post is an ‘issue’ filed for the core-firmware.

Already in the plans to have it implemented but just not yet. :smile:

It’s definitely going to happen but the :spark: team is focusing on the higher priority issues before the rest gets implemented

Thank you Kenneth. Do you you know approximately when the core-firmware will have support for the second uart?

Cheers!
Jim

Hi,

@notronrj

Hi Jim,

If you want it ASAP and can build locally it can be done fairly quickly, (but not ideally from a space, maintainability perspective).

Replicate the current spark_wiring_usartserial.cpp file and change all the references to UART2 things to UART1, then in the begin, ensure to set the alternate pin functions so that D0, D1 are enabled to UART1

I would do it for you but, I am backed up on my client’s jobs at the moment.

@david_s5 would that be so straight forward to implement?

What about the interrupts and all?

I won’t mind giving it a shot since it’s a backlog but it’s definitely going to have bugs lingering :stuck_out_tongue:

@kennethlimcp

Alright you made me look at the file. yep it does look that simple but I did not check the data sheet.

Also check Wiring_USART1_Interrupt_Handler (Declared as weak in stm32_it.cpp) if it is not there make it so.

If it is the same IRQ demux it in stm32_it.cpp to Wiring_USART1_Interrupt_Handler or Wiring_USART2_Interrupt_Handler

Mind you, this is not the long term solution. You could even revert to the non - interrupt version of spark_wiring_usartserial.cpp and mod that file for a “Quick” fix.

Thanks everyone. I’m going to be buying a few of the Cores to experiment with and create a prototype board. Hopefully by the time I’m ready the firmware will officially support the second UART.

Who know, maybe I’ll end up with the time to work on the support and / or help finish it up.

Cheers,
Jim