MBed stablitity and speed?

05 Dec 2014

I am new to Mbed itself, but not new to programming, but some 'things' does not seem 'right'. For instance, I did a state machine to create a 'bit bang' IR UART on a interrupt with a state machine, it is basic a timer interrupt driving a state machine, this creates the start bit etc, the fastest I could get this was 2400 baud (no IR modulation was possible), this was all done on a Nucleo F030R8. Mbed seem such a nice interface and I had an Nucleo available, and I wanted to learn howto use MBed, thats why I first tried it on the Nucleo. This was way to slow because I wanted 72Khz, the need was to create a IR at 36KHz, baudrate 2400. My real target was actually a LPC11C24 (CAN Version) very similar setup, M0, 48Mhz etc. The same state machine had no program to generate the modulated frequency at 72Khz (Using LPXPresso), and indeed it works like a charm .. 2400 versus 72000 ???

I also having trouble with the box standard UART class, just to instantiate a class en use a xx.printf seem to create havoc if the string is to long, this 'to long' is actually short, less than 80 chars or so, if I split the printf it 'works' again..

The getc() also seems non buffered (keypressed from user interface is fine, but talking to other embedded apps loses lots of chars), so I created a ring buffer with interrupts (attach RxInterupt), this seem to solve the speed problem , but I 'lose' this 'attachment' if I print from another instantiated class (RxInterrupt stops to interrupt). I then attach a NULL and the method again, and then it 'works' again.

I tried to 'pass' the main class address to the subclass, tried to public the serial class when the subclass is constructed, but things just stop working, and the answers is not clear. If I try to search for printf problems I end up getting an answer how to print 'Hello world', I need a more advance answer, how to printf from different classes using the Serial Class.

Classes .. Serial versus RawSerial, why RawSerial? , just try to printf in interrupts and see what happens to printf, and you shall know why, but nowhere is this mentioned, perhaps I lack 'common knowledge', or ...