RPC Interfacing with matlab (Librarys won't work)

17 Feb 2015

Edit: I found a Solution so this Post can be deleted/ignored

Original Post: Hello Everyone :)

I'm currently trying to get a Matlab GUI running together with my mbed LPC1768. Unfortunately the Librarys from the Cookbook don't seem to work anymore. The only thing I found which works with my Matlab script is a .bin File.

I have the Matlab RPC Library from the Cookbook Site.

For the mbed I searched here for Informations: https://developer.mbed.org/cookbook/Interfacing-Using-RPC

If I load the rpc_serial_lpc1768.bin from this site into my mbed my matlab-scripts are working fine. I can use matlab commands like:

mypwm = PwmOut (mymbed,p21);
mypwm.period(0.2);
mypwm.write(50);

and I'm able to see a squarewave signal on Pin 21 with my Oscilliscope.

But if I compile the Serial-RPC code above (http://developer.mbed.org/users/MichaelW/code/RPC_Serial/docs/tip/main_8cpp_source.html) my matlab script won't function anymore. Matlab initialises everything without an error and even takes the same commands as in the .bin version but there won't be a squarewave signal on p21.

So basically the same matlab script works fine with the binary file but won't work with the compiled Serial-RPC Program.

Furthermore the bin file has twice the size as the bin file of the compiled Serial-RPC Program. (40kb & 21kb)

There won't be a problem but I need to add some code on my own onto my mbed so I need some File that I have to compile and not just the .bin file.

I read that I'm not the only one with this problem but I couldn't find a Solution.

So I would be very grateful if somebody could tell me what I need to do to use the matlab-mbed-Library on my mbed and am still be able to add something like a rpc custom function.

Thank you in advance

Best Regards, Florian

Note: This post has been rephrased due to my current problem

17 Feb 2015

Hi Florian, I'm experiencing quite the same issues you had. Can you enlighten me of your workaround. Honestly I'm new to Mbed but I have been reading the cookbook for quite some time now, but did not manage to get it to work.

Many thanks, Mark

18 Feb 2015

Hello Mark.

The Problem lies within the mbed-rpc.h Library. As I've been told this Library was updated around a year ago. Unfortunately the library doesn't seem to be Backwards compatible, The Guy who helped me out with this said he wanted to look into it if he has some time at hand.

For now the only Solution he could find was to import the serial-rpc-Program (http://developer.mbed.org/users/MichaelW/code/RPC_Serial/docs/tip/main_8cpp_source.html) Click on Revisions (at the top of your compiler) and use Revision 1 (Jan. 2010 or something like this). Don't update anything! After this click switch and the matlab library aswell as the RPC-Interfacing-Library (https://developer.mbed.org/cookbook/RPC-Interface-Library) will work with this.

At least I could compile it and add the Functions via Matlab. Furthermore I was able to add a custom RPC-Function with this build.

Hope this works for you.

Best Regards, Florian