Problems with LuaRPC module

classic Classic list List threaded Threaded
2 messages Options
raman raman
Reply | Threaded
Open this post in threaded view
|

Problems with LuaRPC module


Hello,

I seem to have problems with LuaRPC module. Just by running Elua on the target,
a sample snippet such as slave, err = rpc.connect ("COM11") throws
me the error "MY ERROR: no data received when attempting to read". (slave = nil)

System configuration:
Windows-7 + All the tools needed to burn the .bin file.
(Have also tested it on Gnu/Linux, Ubuntu 10.04)

Elua cross-compiled for:
CPU: LM3S8962
Micro-controller dev board: Luminary Micro, ARM Cortex M3

I did however read through the source code to understand the protocol used while
communicating with RPC.

The files I have used for this problem definition:
src/main.c, src/luarpc_elua_uart.c, src/modules/luarpc.c

As mentioned earlier, just by cross compiling Elua for LM3S8962, the luarpc.exe
throws me the error:
"MY ERROR: no data received when attempting to read" on
my PC console.

luarpc.c:

static int rpc_connect( lua_State *L ):

    transport_write_u8( &handle->tpt, RPC_CMD_CON );
    client_negotiate( &handle->tpt );

At this point, we can expect the handshake between the micro and
the PC
through the luarpc.exe instance running on the PC.

During the client_negotiate( &handle->tpt ), it is supposed to send out the header "LRPC(3)(default client config)" ('3', for the RPC_PROTOCOL_VERSION, defined as an enum).

I tweaked the boot_rpc() in src/main.c to check if the micro is receiving the header. I added the functions transport_read_buffer()
and transport_write_buffer(). The micro receives junk values, a stream of '#'. Nonetheless, The UART module of the micro-controller works flawlessly.

I have narrowed down on the source of the problem. I suspect that the luarpc.exe instance running on the PC isn't responsive.

How do I proceed with the bug ? Please share your thoughts and give me a few suggestions.

Also, it is given on the website that rpc.connect() returns a HANDLE to the slave. In the C definition of the same function, it returns an 'int'. Have I understood it correctly ?

Raman, Student.

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Problems with LuaRPC module

On Sat, Jun 11, 2011 at 6:00 AM, Raman Gopalan <[hidden email]> wrote:

>
> Hello,
>
> I seem to have problems with LuaRPC module. Just by running Elua on the
> target,
> a sample snippet such as slave, err = rpc.connect ("COM11") throws
> me the error "MY ERROR: no data received when attempting to read". (slave =
> nil)
>
> System configuration:
> Windows-7 + All the tools needed to burn the .bin file.
> (Have also tested it on Gnu/Linux, Ubuntu 10.04)
>
> Elua cross-compiled for:
> CPU: LM3S8962
> Micro-controller dev board: Luminary Micro, ARM Cortex M3

Are you sure that you started the rpc server on eLua's side of the
connection?  The simplest way to do this is to use the boot=luarpc
build option, however you can also start lua on the mcu, then run
rpc.server(<timer_id>,<uart_id>) and then disconnect and connect to
the server using luarpc.  If the server isn't explicitly started using
one of these methods LuaRPC on the desktop side is going to try and
talk to the eLua "shell".

>
> I did however read through the source code to understand the protocol used
> while
> communicating with RPC.
>
> The files I have used for this problem definition:
> src/main.c, src/luarpc_elua_uart.c, src/modules/luarpc.c
>
> As mentioned earlier, just by cross compiling Elua for LM3S8962, the
> luarpc.exe
> throws me the error: "MY ERROR: no data received when attempting to read" on
> my PC console.
>
> luarpc.c:
>
> static int rpc_connect( lua_State *L ):
>
>     transport_write_u8( &handle->tpt, RPC_CMD_CON );
>     client_negotiate( &handle->tpt );
>
> At this point, we can expect the handshake between the micro and
> the PC through the luarpc.exe instance running on the PC.
>
> During the client_negotiate( &handle->tpt ), it is supposed to send out the
> header "LRPC(3)(default client config)" ('3', for the RPC_PROTOCOL_VERSION,
> defined as an enum).
>
> I tweaked the boot_rpc() in src/main.c to check if the micro is receiving
> the header. I added the functions transport_read_buffer() and
> transport_write_buffer(). The micro receives junk values, a stream of '#'.
> Nonetheless, The UART module of the micro-controller works flawlessly.

Here it sounds like you are using the rpc boot mode, which has worked
for me on Mac OS X, Win XP and Linux. I'm not sure why you would
receive a stream of "#" values.

Did you change any other parameters?  What compilers are you using,
etc..?  I assume you're not using the multiplexer (mux) or anything
like that and that you haven't modified the baud rates?


>
> I have narrowed down on the source of the problem. I suspect that the
> luarpc.exe instance running on the PC isn't responsive.
>
> How do I proceed with the bug ? Please share your thoughts and give me a few
> suggestions.

I suspect that maybe there's a configuration problem if you're having
the issue on multiple platforms?  It's hard to know without knowing
if/what you have or might have configured or adjusted.  To my
knowledge the current code should work with boot=luarpc with proper
platform configuration and compilation and if the desktop client
builds correctly.  Knowing which build environment you're using on the
desktop and perhaps any adjustments you've made might help.  One
shortcoming of the way the desktop client works with serial
connections is that it doesn't take a baud parameter and therefore
just assumes that the connection will be at 115200, so if you've
changed that it certainly won't pick it up.

Are you using the built-in FTDI-based virtual com port interface that
the LM3S board provides?

>
> Also, it is given on the website that rpc.connect() returns a HANDLE to the
> slave. In the C definition of the same function, it returns an 'int'. Have I
> understood it correctly ?

Yes, the way the Lua API works is that you push values on the stack
which you wish to return to the user and you return to the VM the
number of results that are on the stack for it.

>
> Raman, Student.
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev