This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

simple Ethernet +CAN data transfer

Other Parts Discussed in Thread: HALCOGEN

Dear Manoj,

   I tried executing the the code only for transmitter out of the two. Pls tell me what i understood is right or nt.

While creating packet in function, create_packet(8 rows, 16 columns) ,

u have created a array (2 rows),

in the first row --   where in 0 to 5 you have inserted data 0xFFh.

                                in next 6 to 11 bits you have inserted the EMAC address.

                               and from 11 to 16 you r writing data 2.

  in the second row-- where in 0 to 7 (if i am nt wrong   'j' will vary from 0 to max 7) you have inserted data2.

pls help me understand, which of these fields are related to data (from where exactly u r fetching the data) ??

At the PC end i am trying to sniff data coming from MAC address- 78:2B:CB:AB:63:6D but i am nt getting anything.

 where am i going wrong???

inserting the code  create_function()  for reference. 

void create_packet()
{
    int i,j;
    packet.packet_length = 0;
    for(j=0;j<6;j++)
    {
        packet.buff[0].buffer[j]=0xff;
    }
    for(j=0;j<6;j++)
    {
        packet.buff[0].buffer[j+6]=emacAddress[j];
    }
    packet.buff[0].buffer_length = 150;
    packet.packet_length += packet.buff[0].buffer_length;
    for(j=0;j<packet.buff[0].buffer_length;j++)
    {
        packet.buff[0].buffer[j+11] = 2;
    }
    for (i=1;i<8;i++)
    {
        packet.buff[i].buffer_length = 150;
        packet.packet_length += packet.buff[i].buffer_length;
        for(j=0;j<packet.buff[i].buffer_length;j++)
        {
            packet.buff[i].buffer[j] = 2;
        }
    }
 
}

Kindly help.

Attaching the code that u sent me for ref.

5353.3755.EMAC.zip

Regards,

Manmesha

  • Hello Manmesha,

    To start, I wanted to be certain you are aware of the CAN2.0B specification for CAN that lays out the requirements for the CAN network and the protocol. Given you mentioned that you  won't be sending any HTML on the CAN network, I am not certain what type pf network you would be connecting to. CAN is a Controller Area Network and not used for general network support. HTML would not necesssarily  be compatible data to send across a CAN network unless you had some kind of interpreter code on the recieve end to extract the HTML out of the CAN packet. You can find more CAN network specific requirements and descriptions in the CAN2.0B specifications. It is also worth noting that you would need a CAN specific tool running on an external PC/Workstation or another device with CAN to setup a CAN network and analyze the packets. Maybe you know all this already and I am only confused by your statement about HTML.

    With that said, have you had a look at the example code included with Halcogen? You can find this by searching in the Help Topics section which will take you throught the steps to generate basic CAN init and CAN driver software/project generation. Using the Help-->example menu item will take you directly to some C source files of these examples. Let me know if this is helpful or if further information is needed.

  • Dear Chuck,

          Thanks a lot for all ur valuable inputs. I saw that code. Not thoroughly. But it seems to be very useful. Thanks a lot.

    What I want to implement is as follows,

        1. I want to accept data through CAN port of HDK kit,

        2. save it memory/register.

         3. Process the data.

     4. put it into a Ethernet packet.

    5. Send it over Ethernet to PC.

    6. PC will receive the data. 

    7. PC might send some data in some cases. Then the data is accepted through Ethernet on the HDK board.

    8. Processed again in the processor.

    9. Put it into CAN protocol format.

    10.  and send it over CAN wires. Above will be the approximate flow of the experiment.

    I would like to know more about, care to be taken while dealing with multiple protocols (in this case its Ethernet and CAN. ) They will mostly not be working simultaneously.

      Meanwhile, I have again stopped getting replies on the earlier thread, where i have asked Ethernet related queries.

     

    With Warmth Regards,

    Manmesha

  • Hello Manmesha,

    The flow of information sounds OK. Given the interrupt based activities for CAN and Ethernet, I don't see that there would be any issues running both simultaneously as long as you manage the data and gate transmission until all the data is received over CAN before being packetized and sent over Ethernet.

    For CAN, there is an explicit protocol to be used including a MSG ID, 8 data bytes, CRC, etc. You can see this description of the packet fields in the TRM and in the CAN2.0B specification. Once you recieve a data packet and validate its integrity, all you need to do is move the data to some RAM location for use by the Ethernet protocol.

    Again, it would be very useful to understand the CAN protocol since it is very specific. Our DCAN module is complient with the CAN2.0B specification that was originally developed by Bosch and is now under ISO or IEC control, I believe.

  • Also, I meant to mention that I sent Manoj a direct email to request he review your additional questions in the other thread. Send me a private message if you continue to have support issues on that thread.

  • Dear  Chuck,

       I have sent u a private msg long time back. Stil i am waiting fro a word from Manoj. I have lots of queries related to the receive code (the second code) along with those i have already mentioned in my earlier posts. I cant start with CAN unless until i do this ethernet part. pls. its been a week Mr. Manoj replied.

    In the second code for receive, I don't see data receive anywhere. Also is that code is a loop dack kind of thing?? i need more info abt that code.

    Kindly help me. 

    Regards,

    Manmesha

  • Dear Chuck,

          I have started working on CAN now. I went through the two codes given in Halcogen  examples. Can you provide me with some documents that will help me understanding CAN?? I have never worked on CAN before this.

    Regards,

    Manmesha.

  • Manmesha,

    You can find more information on CAN by reviewing the CAN 2.0B specification for CAN and by utilizing internet searches and resources available through the SAE.

    Unfortunately, I am not in a position to give any lessons on the basics of CAN communication since this extends beyond the purpose of the forum. Once you have developed your background with CAN, please feel free to return to the forum to ask any relevant questions regarding our CAN implementation and we will be happy to help you understand device specific issues/questions.