11 years, 3 months ago.

Matlab & mbed

Hi,

I am using an mbed as a serial proxy to get the data on the computer. An mbed is what i got on the hand. My usb serial adapter get me BSOD on my windows :(.

Any way, i had quite a trouble to make this work. Because a odd behavior i can't explain.

I read the data off the serial port fine with putty, no problem. When the serial port opens the mbed status led is flashing. When i do the same thing with matlab, sometime this led flashes, sometime not. For some reason the mbed is not sending data, or not detecting the port opening. To make sur i still get data i check again with Putty, still have data coming but not with Matlab ! It work better at a baud rate of 9600 than a baud rate of 115200.

I can't read, can't print. I get the same "Error using ==> serial.fprintf at 144" errors as others do.

I tried may thing with matlab and one that worked is using ReadAsyncMode but then i'm missing data. The odd behavior come when the matlab buffer fills up, then the status led stops flashing and can't start any data transfer again.

Even using the hard or serial break to reset the mbed doesn't do any thing. The only way i can get matlab to get data again is to start Putty, read data, hold hard reset, close putty, release hard reset and then start matlab again. Only then i get data but it hold only until the buffer gets full and the transfer stops.

I wonder how Putty is able to get data transfer again. I tested many options in matlab without any success to restart transfers.

In order to get my data continuously i set up the ByteAvailableFunc callback and processed the data as it arrives.

I'm using Matlab R2012b, mbed is brand new just took it out of the box, Win 7 x64.

It seams that Putty or Matlab are both stopping the transfers but i can't get matlab to correct it.

If anyone has any thoughts on that particular behaviour.

Cheers, Stan

Be the first to answer this question.