Mailbox / Bluetooth communication between Basic- and EV3G-based programs
sergeyzwezdin opened this issue · 4 comments
We're trying to establish communication between two bricks via Bluetooth. For one of them the program created with default EV3G developer environment. Another one programmed with EV3 basic.
If we send string from Basic program to EV3G program, it will work ok. We can recieve message successfully.
But once we send string from EV3G to Basic program, it won't work at all.
Call Mailbox.IsAvailable()
will always return False
.
The code is quite trivial, so I believe it could be bug somewhere in communication protocol:
// send request that checks for existence and tries to retrieve the message
c.Clear();
c.OP(0xDB); // opMailbox_Test
c.CONST(no);
c.GLOBVAR(0); // return value for the existence test
c.OP(0xDA); // opMailbox_Read
c.CONST(no);
c.CONST(252); // maximum string size
c.CONST(1); // want to read 1 value
c.GLOBVAR(1); // where to store the data (if any available)
Could you advise us any further directions to investigate the issue?
Here is our programs for both parties.
Sender (EV3G):
Receiver (EV3 Basic):
Id = Mailbox.Create("0")
LCD.Clear()
While "True"
IsMessage = Mailbox.IsAvailable(Id)
LCD.Text(1,0,0,2,IsMessage)
If IsMessage Then
Message = Mailbox.Receive(Id)
LCD.Text(1,0,10,2,Message)
EndIf
EndWhile
UPDATE: At the same time we're able to communicate:
- EV3G ←→ EV3G
- Basic ←→ Basic
- Basic → EV3G
This is how it defined at EV3: https://github.com/mindboards/ev3sources/blob/master/lms2012/c_com/source/c_com.h#L1326-L1334
I will have to investigate in this a little further. In the meanwhile you could try to test the behaviour of the EV3Basic in both the "PC" mode (program is running on PC and directly remote-controlling the brick), and in "Brick" mode (program is compiled down to the brick using the EV3Explorer). Since the two implementations are completely seperate it could well be that it works in one setup and fails in the other.
We'll try to run in both modes.
Did you have a chance to try this?
It suddenly started working after a few attempts, but after that we had problems again.
Now we're trying to do that by compiling with EV3 Explorer.