What is a ethernet frame sample which can be sent? - vhdl

i want to send a ethernet frame from FPGA to my PC for wireshark to receive
i pass payload into CRC generator to get the CRC result, but i guess CRC error as wireshark not received any thing which is my payload
i got 2 ideas
1. find a ethernet frame in hex code in internet and copy to VHDL to send in order to make sure no CRC error and check whether it send or not? could you post a correct ethernet frame in hex code here?
1b. any free CRC generator code in VHDL available in internet? and any free CRC generator code in C++ language or C# language or Java language for hard code CRC in ethernet frame?
2. use layer 2 programming in ubuntu to send a ethernet frame to another computer,
whether i can send and display the ethernet frame which i send in ubuntu or i need to capture with wireshark in another computer?

Use your FPGA tools to create an Ethernet core. This will usually create a testbench for you too. Run that testbench, note down the values of the data produced.
As another alternative, there are some Python libraries I've used in the past to create Ethernet packets.
http://code.google.com/p/dpkt/source/browse/trunk/dpkt/ethernet.py
I've never used this, but it looks like it might be helpful:
http://packeth.sourceforge.net/packeth/Home.html

Related

Linux I2C custom message frame sending

Is it possible to send out a custom message frame on I2C dev from Linux? I am using an i.MX7D board and i would like to use "/dev/i2c-0" device like a simple "serial tty" to "write(fd, bytes, count)". My goal is to send out a single byte for example 0xAB on I2C without any specific slave address and without automatic stop/start bit inserting in my frame.
So i like to make my full custom I2C frame then send it out from Linux. Is it possible, is there any user-space programing techniques in C/C++, Python or any API for it in Linux?
No you can't, because this is limited by the hardware, if you are using the I2c interface, the hardware will limit what you can do.
One way to try is that you can use gpio to simulate i2c or any interface you want to. Many chips support setting the i2c interface to gpio, then you simulate a clock with one gpio, and simulate high and low level with another gpio.
But I don't recommend it, because if you don't follow the i2c protocol, you can't communicate with other i2c devices
Connect two GPIO lines to the I2C bus in addition to the I2C interface. Normally, these will stay tri-stated. When you need to send the magic byte, enable them to send clock and data, then disable them. These won't interfere with I2C, which only drives the bus when transmitting.

Writing to a peripheral in Vivado and then outputting to a LED

I want to create a basic project in Vivado that takes a value that i input to a client, which is sent to a server I made (in C), and then the server writes that value to a peripheral in Vivado, and then that data in the peripheral is sent to an output pin that assigns to LED's, making the LED light up.
Basically I want to go from client-->server-->peripheral-->LED lights up
For example, in the client (a GUI) I want to give it a value such as 0011, which is received by the server. Then the server writes that value to the peripheral which will then make, in this case, LED0 & LED1 not light, but LED2 & LED3 will light.
I know how to make an AXI4 peripheral in Vivado, and the client-server (TCP/IP) has been made. My question is what code/design block I would need to then take the data written to the peripheral and assign it to the LED's?
Should I make the peripheral a Master or Slave? Overall confused how should i proceed from here. I am using a Red Pitaya (Xilinx Zynq 7010 SoC) connected by an Ethernet cable to my computer.
Also, I thought of running the program on the Red Pitaya by loading the bitstream on to it (using WinSCP) by running the command
cat FILE_NAME.bit > /dev/xdevcfg
in PuTTY (connected to the Pitaya by IP address), then running the server on the pitaya, and then sending the signal from the client for the server to receive. Is that the correct way of approaching it?
If my logic is off in anyway please let me know
I am somewhat thrown by your statements.
First you say "I know how to make an AXI4 peripheral in Vivado"
Next I read: "Should I make the peripheral a Master or Slave?"
Maybe I am wrong but to me it says you don't really know what you are doing.
Simplest is to:
Instance a zynq system.
Add the IP with the name "AXI GPIO". (Which, by the way, is an AXI slave.)
Run the auto connection.
Assign the right I/O pins to the GPIO port. (check your development system manual)
Build the system.
By the way you find the address of the peripheral in the address tab and it normally is 0x0080000000.
You wrote that you made a server (TCP/IP). "All" it has to do is write the received value to a register in the GPIO block. (Here I assume Xilinx has a document which describes how the GPIO block works and has example GPIO drivers.)

M600/A3 uart problems

I'm eventually trying to use transparent data transmission to pass messages between the mobile SDK and an onboard device using the A3 API/UART port.
Right now I used DJI assistant to output a timestamp to the API port at 1hz. When I connect a TTL>USB device, I see garbage data coming through. When I connect an oscilloscope with a protocol analyzer, I see one frame every second, but the frame is variable size. The ASCII representation of what does come through is nonsense.
I have double checked that baud is set correctly (and have tried other baud rates). I've made sure the grounding is proper. I've tried probing the pin on the actual A3 port (to remove possibility of EMI on the serial cable). It seems like I'm getting garbage data on the serial line, or I don't know how to decode it properly.
Hi,maybe you can refer to the open-protocol of M100 Link.I think it's difficult to decode the protocol of N3,unless DJI publishes that。

Formatting Modbus requests in ruby

I have a modbus device I am trying to communicate with using an ethernet to RS485 device. I'm not sure whether the device uses modbus ASCII or RTU.
I am trying to format a request to a device with address 1. The command code is 11h. I'm not sure I'm formatting the request properly
Here is the string I am using for ASCII - ":010B000000000C\x0D\x0A"
Here is the hex I'm using for RTU: "\x01\x0B\x00\x00\x00\x00\x0B\xA4"
When I send this command it is echoed back but I'm not getting responses. I've been through the modbus documentation and I think I have the correct byte structure. I'm wondering if I'm encoding it right for ruby?
It turned out my ethernet to RS485 device wasn't capable of the correct timing for modbus. Once I purchased a new unit the ascii strings worked.
Are you sure the checksum should be written in pure bytes, not in ASCII? I mean, try to send :010B000000000C0D0A instead of :010B000000000C\x0D\x0A.
Also, you wrote that the command is 11h - for my understanding it is 0x11 (hex), and you are sending 0x0B. Or the command is 11 (dec)?

HW device via COM port, access individual pins

I'm currently working on a project which involves dealing with a HW device tailor-made for this purpose.
The device will serve the purpose of sending certain data via serial port (COM1, for instance). The data it is supposed to send doesn't matter that much.
I already have some knowledge regarding Windows serial port communication. CreateFile, WriteFile, and so on... BUT...
There is one "engine" on the device, which will send me the data when I ask it to, and in order to do so, I need to send there a signal (10101010) the rate of which will indicate the clock rate of that device "engine".
Here comes the explanation of how this device work. It gets a signal to send data through one pin. I'm supposed to send there 0 for start, 1 for end. Then, after this, it will watch some other pin for signal, sample it, and based on the frequency of ones and zeroes I send to it, it will start sending data via the thrid pin.
My questions are:
How to access individual pins of COM port?
How to manage the frequency and any delays I will need by myself?
I think that maybe I will have to do on this in kernel more by use of device drivers which will have to be developed.
There is an easier way. The COM port will send out the signal of alternating 1s and 0s if you just send a 0xAA byte.

Resources