Basic hello world program using uIP library on embedded board - c

I am currently working with an embedded FOX G20 V board with an ATMEL AT91SAM9G20 processor. I am hoping to be able to establish a connection by ethernet between this board, and a linux machine. The protocol of communication is using the uIP library (smaller implementation of TCP/IP intended for embedded boards).
Anyway, I've downloaded the developpment kit offered by the processor, and it has countless examples of different types of communications, one of which includes a hello world program.
However, at this point, even with the example, I'm relitvely stuck. I am un sure which file of the hello world project it is I have to compile since there are many of them. Is it the main.c that is located in at91sam9g20-ek.zip\at91sam9g20-ek\packages\basic-emac-uip-helloworld-project-at91sam9g20-ek-iar.zip\basic-emac-uip-helloworld-project-at91sam9g20-ek\at91sam9g20-ek\basic-emac-uip-helloworld-project\ or is it another file?
The whole point is to get a communication established by the board and the remote host (in this case my Linux machine), and send it "hello world" through ethernet. I am guessing that the application in this case defines its register addresses in which the board will be able to receive the connection from the remote host (I may be wrong).
In any case, I am hoping to get help by any "experts" that are familier with the project that may guide me, or explain to me how exactly to build this application they have provided.

I'm not familiar with this board but according to this link the application is supposed to start a telnet server (on port 1000) and an http server. I suggest that you look at the output on the serial link (to get the IP of your board, let's assume 10.159.245.156 as in the example), and if you get what is expected then you can try to telnet to your board:
telnet 10.159.245.156 1000
The kit gives you project file for three toolchains (IAR 5.4, Keil and GNU). You'll have either to open the correct one depending on your toolchain (which one do you use?), or adapt if you use another one.
Edit: You apparently use the IAR toolchain, thus you need to open the *.eww file (for instance basic-emac-uip-helloworld-project.eww). This example only obtains an IP and displays statistics on the debug output (serial link?). There are other examples for a telnet or http server.
Moreover it's a detail but I think the emacs tag is irrelevant in your post. I think you confused EMAC (what is this?) and Emacs which is a popular text editor.

Related

Beaglebone Black won't show-up as /dev/ttyUSB

I am trying to learn Linux by following instructions in "Mastering Embedded Linux Programming" by Chris Simmonds. By following the book and with some help from Stack_Overflow_1, i was able to build the MLO and u-boot.img.
However, when i connect USB cable to my PC and execute the ls /dev/tty* command, i cannot find any device with /dev/ttyUSB. All i can see are devices with /dev/tty0-63, /dev/ttyS0-31 and one /dev/ttyprintk.
Also, when i press down the S2 button and connect the USB cable, i can only see the power led glowing and nothing else.
I have properly built the u-boot (three attempts to get it right).
Also, as per the instructions in the book, i am only testing the u-boot stuff and yet to reach the kernal part.
If i remove the sd card and connect the USB, im an able to talk to my BBB over ssh (192.168.7.2).
How to i get the u-boot to work? Thank you!
If you don't have one yet, I'd recommend to get a USB-to-serial device (3.3V Vref). You connect it to the debug UART (J1) which is located next to the P9 side. Nowadays those are very cheap and can cost below 1$. Ones that feature a genuine FTDI part will be 5-10$ at least.
The serial port you are referencing is only available once the device has passed through U-Boot, booted the kernel and finally userspace has set up the communications.
Especially when working with U-Boot and the Kernel, low level UART access is crucial.
As a further note, could it be that the Book refers to the (white) original Beaglebone? That has a FTDI USB-to-UART chip on board and will allow you even U-Boot access. You can do the same things if you have the above mentioned USB device.
https://groups.google.com/g/beagleboard/c/eNDjK05spY8/m/GPvhcP52BAAJ shows that one needs to hold the space key to enter u-boot.
Also, the info. here might be more up to date compared to the book.
https://www.digikey.com/eewiki/display/linuxonarm/BeagleBone+Black
There is no way to copy and paste everything from the eewiki. I just left you the link. Enjoy!

Sending smtp email from microcontroller

This may not be in the right location, so tell me and I'll move it.
I am a recent EE grad and I was hired to build a system that exists on a SoC with a simple 32-bit processor. The system basically monitors several external devices and performs some DSP on it, and then is supposed to send the results using a WiFi device (in my case I have the ESP8266 using UDP) to an email server for logging/notification.
I have been trying to find a library that I can use, but my uC can only program in C and I have it set up for UDP, and everything is in C++ using some other protocol, or something else completely.
I am great at DSP, decent at SoC's and uC's, but when it come to this email server communication thing I am at a loss.
I have successfully configured everything for the sensors, the datapath, the DSP, and connected the system to my WiFi via UDP, but I have yet to figure out how to send data to any servers.
Could someone help me understand how I should go about this?
I have looked into some simple SMTP commands such as HELO, MAIL, RCPT, DATA, etc. but I cannot understand how I actually should implement them in my code.
When I send out the WiFi data via UDP what type of data do I send and how do I format it? Do I need to send any other kind of flags? How should I expect the response? I also know the data has to be transformed into base 64 which is confusing me further.
I am also not super familiar with UDP to begin with, I have been using libraries that are part of the SoC's default library to connect to my WiFi.
I know these may either seem like obvious or stupid questions but it is were I no longer have any knowledge, and everything I find online doesn't make sense, or doesn't attempt to explain it, just gives a pre-made solution
I have found the RFC2821 but it doesn't get any clearer.
I know that's a lot but any help at all would be a lifesaver!
Since you are asking this question, I'm assuming that you are not booting and running an OS suitable for micro-controllers such as an embedded variant of Linux or such. If you were, you would simply be able to take advantage of possibly built in applications or other existing code.
But you don't mention having written an Ethernet stack, so are you using some other library or operating environment which might have some of the functionality needed for an implementation of SMTP?
If you don't and really do need to write your own SMTP client to run directly on the processor you are using, then you should be able to find plenty of examples of source code for this. A quick google search of How To Write an SMTP client showed a few articles with some example code. One article seems to be an exact hit, but you need to look at it further.
However, I would highly suggest just sitting down with a telnet client and connect to an SMTP server you are allowed to use and try the commands you need to just send a message. If you only need to send text, you don't need to get involved in MIME encoding or anything like that.

How to create a BACnet client in C

I am trying to create a client in C that will talk with a BACnet server. This BACnet server is stored on an industrial device (CAN2GO) and I am not sure how I could talk with this device.
I spent quite some time reading documentation for BACnet and I never found a clear example for a BACnet client. I already did some server and clients using TCP and UDP but I don't know how to start this BACnet client and I must say I am getting quite desperate.
I found a library which seems to correspond to what I want which is called BACnet protocol stack but when I tried the whois exemple no device was found (I expected to found the bacnet server but maybe I shouldn't ?).
So my question is : could you give me an exemple in C, or another language but C would be better, that would communicate with a BACnet server (nothing complicated just a question and analysing response). This example could be using the library I just wrote about or if you prefer another library I am of course open to everything.
Thank you very much for your time and answers.
I have used that stack and it is the best open source one you are going to find. If you cannot see anything using the demo\whois\bacwi example from that library, then there is something wrong with your setup. In particular, are you using IP? Are your BACnet client and BACnet server on different machines (they cannot be on the same without some serious tweaking)? Are the two machines on the same IP subnet? (They must be, once again, unless you do some serious tweaking (in this case, setting up BBMDs (BACnet Broadcast Management Devices))).
You will also want to try the "Read Property" example (demo\readprop\bacrp.exe) to actually read a value from the server.
If you are still stuck, then post your detailed problem at the link on Sourceforge, Steve, the author, is very responsive to questions.
I am currently using the stack - just started. I had a little trouble at first, not sure if my problem is the same but.. I basically am using some BAC components made from Schneider Electric (UNC-500) and an old un-supported platform (Niagara R2). On my laptop I created a host server and addressed it to a private LAN network between it and the UNC. My laptop was also using wifi, which was utilizing DHCP, so I had two separate interfaces going. This was my problem. I couldn't read or get 'I-AM' responses back from the UNC. As soon as I turned the WIFI off, I got the 'I-AM' broadcasts. Make sure that you are on the same network as your device, and that there are not other interfaces active. Maybe there is a way to assign the interface to use, IDK. I just started using it.

Hooking network functions using a driver, a high-level overview?

I have just managed to write my first windows driver (havent registered it yet- but i managed to get the things created!).
I wondered if someone can give me a high overview of how I could achieve the following:
I would like to write a driver which will implement some behaviour when a network packet is received by the computer, before windows does what it does with the packet, i'd like to take this data and output it to the console of a C or C++ program.
Lets assume I have a C/C++ program written, which has a console. How does the C/C++ program interact with the driver I wrote which is hooking the network activity? Is it simply some C code which calls my drivers, the function returns the data as an object and then I can use that object to display in the console?
Thank you in advance for any possible replies
You don't need a driver for this task. Use packet sniffer library like PCap (actually you'll need WinPCap). It's really simple to capture packets and print them to console.
Alternative way is raw socket. But desktop Windows (as opposite to Windows Server) limits raw socket functionality.
If you really want a driver, or have a requirement to manipulate or filter packets before they hit the windows network stack you need to look into filter drivers.
This filter driver can then expose a device file on which your user space application can then read/write. The windows DDK contains examples.

How does Flash communicate with dll files

I want Flash to communicate directly with
dll files. How can I do this?
If Flash works, great! I just need an honest and descriptive answer
Thanks,
REQUIREMENT:
• Work without a server
• Understand what protocol I can use
DESCRIPTION:
• Flash GUI interface
• Stand alone unit
• It has a change acceptor and other hardware
There's no accommodations being made for Flash. I've
got to make this easy for other developers, and need enough info to
draw a diagram of how this will work.
Contrary to the other answer, Flash doesn't "run on the host" it runs "on the client" via plugins or standalone players. The server send the client a bytecode compiled package and the client platform executes that code locally. Flash Player and AIR are those platform. Flash will communicate with a server no matter what underlying OS there is, but you need to use the methods built into Flash like ExternalInterface (Flash <-> Javascript), fsCommands (Flash <-> Javascript), or Flash Remoting with Coldfusion Server. You can also use some rudimentary XML requests and posts.
The server simply serves the content and in the case of Remoting flash and Coldfusion swap binary data packets that they both understand. Coldfusion handles the packets server side and Flash handles them Client side.
As far as DLL access. Not likely. I have not tried to have flash access a DLL, nor would I want to. Maybe if you gave more of an idea what you are trying to do I can lead you in a different direction.
i doubt that will "work without a server".
Maybe if you use AIR, but i am not sure that will work.
Flash runs on the host. Which may be a unix that does not support "windows" dlls.
Or the Dll may not work under 64bit Windows 7.
you may at least need a Database-server or an web server.

Resources