BeagleBoneBlack + Arduino Ethernet shield refuse to communicate

Discussion in 'Computing and Networks' started by Shagas, Jul 11, 2015.

  1. Shagas

    Thread Starter Active Member

    May 13, 2013
    802
    74
    I'm having some issues getting my BeagleBoneBlack (BBB) to talk with my Arduino ethernet shield.
    The BBB is running Java and I'm using standard sockets to write/read a message on the UDP port.
    The following setups work:

    Java (BBB) -> Packet Sender (on windows PC) : Packets are successfully sent and received
    Java (on Windows PC) -> Arduino Ethernet shield : Packets are successfully sent and received
    Arduino Ethernet shield -> Packet Sender (on windows PC) : Packets are successfully sent and received
    Java (BBB) -> Arduino Ethernet shield : !!! FAIL !!! Cannot get the two to talk to each other.

    Anyone have any idea as to why I can get my pc running java to talk with the Ethernet shield but the BBB running the SAME program
    refuses to talk (A connection is established though as far I understand. It throws and error when there is no physical connection).

    Details:
    I'm deploying the BBB remotely from my PC through Netbeans through USB and the BBB is connected to the ethernet shield through classical ethernet cable.

    The snippet running on JAVA:


    Code (Java):
    1.  try {
    2.  
    3.                 System.out.println("Waiting for packet from SYSCU...");
    4.    
    5.  
    6.                 BUFFER = new byte[3];
    7.    
    8.                 // Receive request
    9.                 PACKET = new DatagramPacket(BUFFER, BUFFER.length);
    10.                 SOCK.receive(PACKET);
    11.    
    12.                  // Print out received message
    13.                 String msg = new String(BUFFER, 0, PACKET.getLength());
    14.                 System.out.println("Message received from SYSCU: " + msg);

    Snippet running on arduino:

    Code (C):
    1. void setup() {
    2.  
    3.     Ethernet.begin(mac,ip);
    4.     Udp.begin(localPort);
    5.  
    6.     Serial.begin(9600);
    7.  
    8.  
    9.   while(1){
    10.  
    11.  
    12.     char str[3];
    13.     str[0] = 'a';
    14.     str[1] = 'c';
    15.     str[2] = 'k';
    16.  
    17.  
    18.     // Send a new packet
    19.     Udp.beginPacket(remoteIP, remotePort); // localPort
    20.     Udp.write(str);
    21.     Udp.endPacket();
    22.  
    23.     Serial.println("Packet sent, waiting 1000ms ");
    24.  
    25.     delay(1000);
    26.  
    27.   }
    28.  
    29.  
    30. Thanks in advance.
     
    Last edited: Jul 11, 2015
  2. tjohnson

    Active Member

    Dec 23, 2014
    614
    121
    Just a tip: If you use [code=java] for your opening code tag, your code will have syntax highlighting.

    Sorry that I can't help more, but I don't know Java and have no experience with BeagleBoneBlack or Arduino.
     
  3. Shagas

    Thread Starter Active Member

    May 13, 2013
    802
    74
    Thanks for the tip, I'm not sure I correctly understood though. In any case I used the
    [C.O.D.E=java] tag that I found somewhere else on the forum.[/CODE]
     
  4. tjohnson

    Active Member

    Dec 23, 2014
    614
    121
    Sorry for the confusion. You don't need to use the [mono] tag, but it showed up momentarily in my post before I edited it to correct my formatting. Use [code=java]enter code here[/code] and [code=c]enter code here[/code]. The code in your post has syntax highlighting now.

    EDIT: Good, you figured it out. I didn't see your edited post until now.
     
    Last edited: Jul 11, 2015
Loading...