For anyone interested in attaching different processors to MRL you will need to understand the serial data flow commands.... knowing these there is no reason to be constrained to only using Atmel type chips.

In my case I am coding a Parallax Propeller to replace the Arduino ....

The Idea is to get the Propeller to Emulate an Atmel chip .... this means that all the other awsome services written for MRL will be transparent and theoretically work. .... (with more speed)

(80Mhz & 8x parallel processors with video capabilities is my calling.... :-)

So the information here is the Stuff that you need to be aware of to get things started with Digitals/Analogs/Servos.

These are just a few commands...the most useful (in my eyes), however there are a few more ......

Its posted here for my reference (and of course your enjoyment)/  fallback so i know where to dip in again when all is lost........

Anyone wishing to contribute is welcome ....filling in any missing bits or extra notation as it were....

Note on conventions used below :-

In the data streams below i and using a ¦  to separate the bytes and (xx) to indicate the digital/analog/servo we are interested in.

Hex Byte AA is the Magic number which indicates start of any payload.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Ths is based on MRL talking to an Arduino UNO (ie our Propeller, any other MPU)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Your MRL is fired up .... Arduino service loaded ....

On the Arduino Tab ..... select board as UNO

Select your COM port .......

.... The moment COM port is selected MRL issues a 5 byte "Are you There Command".

HEX  5 byte command :-

MRL >>serial>> Arduino :-      AA ¦ 03 ¦ 1A ¦ 00 ¦ 00

When the Arduino see this command it sends back its 4 byte  handshake command

Hex 4 Byte command

MRL <<serial<< Arduino :-     AA ¦ 02 ¦ 1A ¦ 09

When MRL hears this return handshake .......Good times is displayed on the MRL terminal and it opens up a gateway between the two devices.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Now that this gate way is open you can switch to the Oscope, and send quite happily commands between the two.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

First Digitals Via the Oscope  ...... (once a command is sent the Arduino streams data)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

(digital D0/D1 are blocked as they are tied to the arduino RXTX pins)

By pressing the D2 pin ,on the Oscope overlay MRL issues 2 x 5 Byte payloads to the Arduino :-

HEX 10 Byte string  ( the bracketed relates to the digital pin D2 we are interested in) :-

MRL >>serial>> Arduino :- AA ¦ 03 ¦04 ¦ (02) ¦ 00 ¦ AA ¦ 03 ¦ 0F ¦ (02) ¦ 00

By pressing the D2 pin to De-Select on the Oscope overlay MRL issues 2 x 5 Byte payloads to the Arduino :-

HEX 10 Byte string  :-

MRL >>serial>> Arduino :- AA ¦ 03 ¦04 ¦ (02) ¦ 01 ¦ AA ¦ 03 ¦ 10 ¦ (02) ¦ 00

The reply sent back to MRL is a 5 Byte payload 

     MRL <<serial<< Arduino :- AA ¦ 03 ¦ 01 ¦ (02) ¦ 00   ...... for logic "0" applied to pin 2  

or MRL <<serial<< Arduino :- AA ¦ 03 ¦ 01 ¦ (02) ¦ 01   ...... for logic "1" applied to pin 2

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Digitals Via the Arduino Board  "Pin" diagram.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

By pressing the D2 pin using the arduino board graphic ...MRL sends a  payload to the Arduino.

D2 pressed "ON"        MRL >>serial>> Arduino :- AA ¦ 03 ¦ (02) ¦ 01   (4Byte)    ???????? one byte missing

D2 pressed "OFF"      MRL >>serial>> Arduino :- AA ¦ 03 ¦  00 ¦ (02) ¦ 00   (5Byte)

and.....D3

D3 pressed "ON"        MRL >>serial>> Arduino :- AA ¦ 03 ¦ (03) ¦ 01

D3 pressed "OFF"      MRL >>serial>> Arduino :- AA ¦ 03 ¦ 00 ¦ (03) ¦ 00

(Note to Gareth TX reply back from Arduino needs to be inserted here ............. when the time is right :-)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Secondly Oscope Analogs

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

By pressing the A0 to SELECT on Oscope, MRL sends 3?? x 5 Byte payload to the Arduino

MRL >>serial>> Arduino :- AA ¦ 03 ¦04 ¦ (0E) ¦ 00 ¦ AA ¦ 03 ¦ 04 ¦ (0E) ¦ 00 ¦ AA ¦ 03 ¦ 0D ¦ (0E) ¦ 00  ????????

appears to be TXing extra contol string ???

By pressing the A0 to DE_SELECT on Oscope, MRL sends 2 x 5 Byte payload to the Arduino

MRL >>serial>> Arduino :- AA ¦ 03 ¦ 04 ¦ (0E) ¦ 00 ¦ AA ¦ 03 ¦ 0E ¦ (0E) ¦ 00

The Arduino Sends back a 6 Byte Payload :-

    MRL <<serial<< Arduino   :- AA ¦ 04 ¦ 03 ¦ 0E ¦ 00¦ 00   for analog value of 0V

or MRL <<serial<< Arduino  :- AA ¦ 04 ¦ 03 ¦ 0E ¦ 03¦ FF   for analog value of 5V

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Thirdly Servos via the "Servo service"

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Install the Servo service and bring up the Servo Tab :-

Select the arduino as connective device and decide on pin to be attached (we use D2)

The moment you press the Attach button MRL sends  a single 5 Byte payload to the Arduino

(Attach D2)        MRL >>serial>> Arduino :- AA ¦ 03 ¦ 06 ¦ 00 ¦ 02

and when you Detach, MRL sends  a single 5 Byte payload to the Arduino

(De_attach D2) MRL >>serial>> Arduino :- AA ¦ 03 ¦ 09 ¦ 00 ¦ 00

.......and when attached......

adjusting the slider bar in steps   , each step MRL Sends a single 5 Byte payload to the Arduino

Slide bar 000 position :- MRL >>serial>> Arduino :- AA ¦ 03 ¦ 07 ¦ 00 ¦ 00

Slide bar 180 position :- MRL >>serial>> Arduino :- AA ¦ 03 ¦ 07 ¦ 00 ¦ B4

And attach/deattach on Pins 3 :-

(Attach D3)        MRL >>serial>> Arduino :- AA ¦ 03 ¦ 06 ¦ 01 ¦ 03

(De_attach D3) MRL >>serial>> Arduino :- AA ¦ 03 ¦ 09 ¦ 01 ¦ 00

And attach/deattach on  pins 4 :-

(Attach D3)        MRL >>serial>> Arduino :- AA ¦ 03 ¦ 06 ¦ 02 ¦ 04

(De_attach D3) MRL >>serial>> Arduino :- AA ¦ 03 ¦ 09 ¦ 02 ¦ 00
 

As far as i can tell there is no Payload sent from the Arduino to indicate any action during this poll action.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Thats the Data so far ....

GroG

10 years 5 months ago

This is very exciting Gareth !  You are making the Prop behave like an Arduino, but if there comes a time which you want to expose some of the additional capabilites of the Prop (which the Arduino does not have) There is a Propellor Service - http://myrobotlab.org/service/Propellor (It is just a copy of Arduino - and will share an interface with Arduino - but if there are new things to use we can certainly enhance it)

Thanks for all your great high quaility Elvish Sir Gareth.

We Salute You !

!

GroG

10 years 5 months ago

From the Pins tab hitting an Uno Digital 5 Pin gives me

 MAGIC_NUMBER|SZ 3|FN 0|P0 5|P1 1

This is a digitalWrite(5,1)  - when MRLComm.ino starts - it sets all pinModes to out...  but this is before MRL attaches...  its just assumed that the pinMode is set to out initially - so its not sent ... 

setting it off gives me..

MAGIC_NUMBER|SZ 3|FN 0|P0 5|P1 0

which is digitalWrite(5, 0)  .. and correct size

hitting the IN button on the pin tab for pin 5 gives me 

MAGIC_NUMBER|SZ 3|FN 4|P0 5|P1 0    <--- setting pin mode to in - still correct size - then it will send a digital readl pollling start command

GroG

10 years 5 months ago

Heh .. I found a bug .. hitting the In button for me again doesn't toggle it.. :P
I'll have the elves look into that one...

Gareth

10 years 5 months ago

I have re-checked the analog polling (both oscope&pins) request from MRL >>> UNO with a serial sniffer (propeller) watching the port :-

MRL Txs  >>>> AA ¦ 03 ¦ 04 ¦ 0E ¦ 00  plus  AA ¦ 03 ¦ 04 ¦ 0E ¦ 00  plus  AA ¦ 03 ¦ 0D ¦ 0E ¦ 00   (3 payloads!)

This does work and the uno sends back correct info.....however its not what I would have expected.

... my observance is :- only AA ¦ 03 ¦ 04 ¦ 0E ¦ 00  plus  AA ¦ 03 ¦ 0D ¦ 0E ¦ 00 is required. (2 payloads - tested by manual polling).

Am I missing something ......

So from what you've just posted it seems there is no "size" issue in message?  Is this true?  A "size" issue would be most distressing - because its a violation of the "structure" of the message.  

I would like to look into any occurance of that first.  If that is not the case (I have not seen the size issue problem yet) - then I will gladly look into the details of too many messages or wrong messages...

Just want to make sure the structure of the message is correct.