Basic help for a newbie to embedded processing :)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Basic help for a newbie to embedded processing :)

13,484 Views
MJB
Contributor I
Hello,
I recently got a Demo9s12ne64 board and I must say I'm somewhat overwhelemed. I've done a bit of assembly way back when but not embedded programming with C. I've looked at this forum and everything seems so far over my head!

I've tried googling for some tutorials but was unable to find anything of great use. I was wondering if anyone could help me out by pointing me to simple documentation on how to do something as simple as blinking an LED. Anything to get me up to speed.

It's great that this forum seems very active. This freescale processor seems pretty cool so hopefully I can learn it well and be around here for a while.

Thanks.
Labels (1)
0 Kudos
19 Replies

1,510 Views
MJB
Contributor I
I am using metroworks codewarrior. My understanding of embedded systems isnt that great. All the bells and whistles of the mc is great but I need basic understanding IE how can I handle interrupts from the spi in C? I can't jump into programming it for full blown network use just yet. I just turned on my LEDS so that gives you a sense of where I'm at.

Thanks for the responses.
0 Kudos

1,510 Views
pittbull
Contributor III
Here you can find some tutorials: http://www.ece.utexas.edu/~valvano/EE319K/
(see the aLecXX.pdf files)
0 Kudos

1,510 Views
MJB
Contributor I
The valvano lecture files were nice. Thanks. I actually remember an instructor refering me to them a while ago(I think he was an ex valvano student). Does anyone have any super simple examples like adding two numbers over ethernet. I'm working on getting the spi working but if I could get ethernet working im sure spi would be no problem! I already completed the embedded processor "hello world" by blinking the leds. Just trying to think of things to do to help me learn:smileyhappy:

Thanks for all the help.
0 Kudos

1,510 Views
mjbcswitzerland
Specialist V

Hi

Don't forget the Ping demo at the link I previously sent. Here you get all the code you need to get the Ethernet working. Since you can study it without hardware it is perfect for learning (documentation included).

Now you've talken your first steps this will get you running in no time - it's completely free for students, so take it or leave it...

Cheers

Mark Butcher
www.mjbc.ch

 

0 Kudos

1,510 Views
MJB
Contributor I
Thanks but honestly I think this is a bit over my head.
0 Kudos

1,510 Views
imajeff
Contributor III
For MJB, the things to google for will be not for an NE64, but for the MC9S12DP256, or MC9S12C32. That's where we begin learning about the 9S12 family of MCU.
0 Kudos

1,510 Views
Wind
Contributor I
 
I really like your demos and they impress me a lot. thanks for sharing.
what language you use to build the active web? can I use perl ( cgi) to do this? will the MCU NE64 works with perl? 
is each of the demo just take up 25K Flash ROM?   this is great
 
I am new in ethernet, html, perl , cgi and c. I used to program the mcu with assembly language but now switching to C and  learning the ethernet stuff.
0 Kudos

1,510 Views
mjbcswitzerland
Specialist V
Hi
For reference, the demos are in C code (optimised for embedded systems). The web sides are normal html loaded via FTP (rather than being compiled into the code which is typical of many solutions - the advantage being that the web pages can be updated by anyone [eg. customised for a customer] without having to recompile and download via BDM for example. New features can also be added simply by modifying web page content.).
The interface allowing dynamic web page generation and control functions is very simple. In the html file there are a few special markers. Each time the web server encounters one, it asks the application what to do (egs. for a string / value to be displayed, or whether to select a check box or pull down list entry, to disable an element, or to insert a table of length and content to be defined by the application itself).
The application simply starts the web server and passes parameters as to whether it wants it to work with authentication, to support such dynamic features - in which case it must understand the markers so that it knows what to pass back for insertion.
How the web server actually works and how it does the manipulation is not needed to be known by the application - it just supplies the data on request.
One demo is down today due to some work with the board, but when it is back up simply use FTP to its address ftp://212.254.22.36 and you can see the web pages inside of it and load one to see the control format. You could also modify it and load it back, after which it will appear in the browser next time you update the display.
 
I am sorry but I don't know whether it will be possible/beneficial to use pearl to program web servers for the NE64 since I don't know enough about it - the NE64 is also very small and what ever is used it should be very efficient. C code is, after all its years, still a very good solution...
 
The demos are about 25k in code size - with 16 or 32k FLASH file system for the web pages [depending on which demo you are looking at]. The code size value is valid using a good compiler [IAR for example]. The GNU compiler is 'good' but can not match the code size, requiring about 40..60% more space. This can get critical in the NE64, depending on what is to be performed. A good compiler can be very expensive but can also save costs when a larger chip is to be avoided for large production quantities...
 
Regards
 
Mark Butcher
www.mjbc.ch
 
0 Kudos

1,510 Views
Wind
Contributor I

hi Mark,

did you mean that the web pages with the following IP http://212.254.22.36:8080, http://212.254.22.36 and  http://212.254.22.36:8081 are not embedded web page ( not embedded in MCU)? are they storing in external ROM ie compact Fash card , EEPROM?

if they are storing in external ROM in html form, how do program MCU to read the html  from external ROM ? any tips or reference code?

 

thanks for replying and your time

 

0 Kudos

1,510 Views
mjbcswitzerland
Specialist V

Hi

Where the web pages are stored is not that important. I support two possibilities with the NE64 (I use always the 80 pin version without extended bus so that 10/100LAN is always available - with expanded bus the LAN can not run at 100M).

1. I have a FLASH file system in the page 0x3d, which is 16k in size. This is adequate for about 5 or 6 html pages doing functions as at the demo(s).

2. I have an option to use a FLASH/EEPROM based file system over the SPI, allowing the storage of more pages (eg. cheap SPI EEPROM M24C04-WMN6) which extends the space to 32k. The file system interface is compatible - the user can decide which solution he/she would like to actually implement. This extends to about 10 such web sides, or less more interesting ones. The 0x3d page is then free for more program code.
There are also very large SPI FLASH devices which could be used to obtain MByte memory solutions (eg.  Atmel  AT45DB321 - 32 MBut SPI FLASH), but this is probably overkill for NE64 based web servers! These are more useful for logging data and such.

You can see the web site from Jesse Lackey at
http://www.celestialaudio.com/MC9S12NE64/
He uses a 128MByte Smartmedia (although not for html)...

By the way. The speed of collecting the html data from an external SPI device is not really important. This is generally much faster than Internet transmission delays and so there is no real requirement to use high speed memory for such (general) embedded web server applications.

Regards

Mark Butcher
www.mjbc.ch

 

0 Kudos

1,510 Views
Wind
Contributor I

hi mark,

you quote:

1. I have a FLASH file system in the page 0x3d, which is 16k in size. This is adequate for about 5 or 6 html pages doing functions as at the demo(s).

 In the application note AN2700 and Demo project AN2836SW , all the html files are  converted in to C and compile with code warrier IDE then burn in MCU.  I am not familiar with the flash file system which can store normal html files and not code, could you guide me how to do this?

you quote:

The web sides are normal html loaded via FTP (rather than being compiled into the code which is typical of many solutions - the advantage being that the web pages can be updated by anyone [eg. customised for a customer] without having to recompile and download via BDM for example. New features can also be added simply by modifying web page content.).

 how to put the html file into MCU NE64 if not compile into code? how to load via FTP?  any documents that I can read up?

thanks for letting me know the demo web site from Jesse Lackey . It is a good one.

 

0 Kudos

1,510 Views
Wind
Contributor I
hi mark,
 
thanks for all the replies.
I found a ebook  and I am slowly reading up.
 
TCPIP lean ebook: Web Servers for Embedded Systems (2nd (recent) Edition) by Jeremy Bentham (2002)
 
for those who wants to downlod
 
regards
0 Kudos

1,510 Views
mjbcswitzerland
Specialist V

Hi Wind

I will read the ebook since I haven't seen this before.

About loading web pages to FTP. The reason why I don't like compiling code into a project is simply due to the fact that it is totally inflexible and a bit of a big hammer solution. It works of course, but who wants to make a new software release due to a change in a web page - imaging having to reinstall your Apache web server every time you modified your homepage, so why in an embedded sysetm?

FTP is also very comfortable - everyone with a browser can do it since FTP is built in - no special and unknown software for the average user. Try the following:
Click on this link: ftp://212.254.22.36 and you will be connected to a demo embedded FTP server. You will see a number of files [note - needs Internet Explorer and the option "Use passive FTP" should be disabled]. The file 0.htm is the start side of the demo web server at the same address.

Copy this to your PC [using copy/paste or drag and drop]. Edit it with any text editor (for example, add a couple of lines of text) and copy it back [again with copy/paste or drag-and-drop]. This will overwrite the existing file and then when you browse to the web server [http:// instead of ftp://] {login "ADMIN" "AL6000S"} you will see that the start side now displays the new page with your modifications. It should be quite clear that this a much better method. [Or else I would have to send you my source code so that you could modify it, compile it and drive to the demo board [maybe you would have to fly to Switzerland] to download the new software version - not really what I call user friendly...].

A couple of other notes: The FTP server can be started and stopped via the web server so only actually needs to be activated when needed. Afterwards it can be desactived to stop any one else from messing around with the files.

When I want to do debugging or maintenance work I overwrite the web pages with other web pages which support the things which I want to do. Afterwards I copy back the originals [project or customer specific ones] - meaning that although the NE64 has only a limited amount of space for files at a time, I can still have a great number of different files which can be loaded as required for specific tasks.

Regards

Mark Butcher
www.mjbc.ch

 

0 Kudos

1,510 Views
Wind
Contributor I
hi mark,

thanks for the hint, I manage to download the ftp file.

In the transition period, the following page is shown in 0.htm rather than the AL6000S configuration menu. what happen?

regards

FTP directory /0.HTM at 212.254.22.36


Up to higher level directory
02/05/2006 12:00AM          1,906 0.HTM02/05/2006 12:00AM          2,587 3.HTM02/05/2006 12:00AM          2,343 7.HTM02/05/2006 12:00AM          1,743 C.HTM02/05/2006 12:00AM          3,080 G.HTM02/05/2006 12:00AM          2,566 L.HTM02/05/2006 12:00AM          1,726 P.HTM

0 Kudos

1,510 Views
mjbcswitzerland
Specialist V

Hi Wind. I'm not sure I understand the question.

I logged into the web server and see your message "Hi wind is here. Thanks for sharing" so you could obviously upload the html file and download the modified version - which is obviously great.

Also started reading the book you pointed out. Reminds me of when I started working on the uTasker - probably there are some good details. The first difference that I see is that the book doesn't use an operating system whereas the uTasker integrates the TCP/IP stack with a streamlined operating system. The second point is that the code uses specific PC Ethernet cards for testing, whereas the uTasker simulator can share one single PC card [of any kind - code is not NIC dependent] and can do client/server testing using the one interface. In addition testing is also possible using Ethereal recordings ['offline' you could say]

Will need a few days to get to know more details.

Cheers

Mark
www.mjbc.ch

 

0 Kudos

1,510 Views
Wind
Contributor I
hi mark,
 
when I opened the FTP folder and accessd the 0.HTM file. It gave me the following web as shown below (see attached file). The rest of the HTM files were OK.
 
I tried to access 0.HTM in 1/2 hour but failed ( the same web page below was shown). I closed the FTP folder and some time later I tried to access it again. This time it worked. I managed to make changes on 0.HTM. That is why you can see my message  "Hi wind is here. Thanks for sharing"
 
my IE always hang when I copy/save the 2.HTM file.
 
I access the 0.HTM today and the same problem happen again
 
regards
 
FTP directory /0.HTM at 212.254.22.36
<hr/>Up to higher level directory
02/05/2006 12:00AM          1,906 0.HTM02/05/2006 12:00AM          2,587 3.HTM02/05/2006 12:00AM          2,343 7.HTM02/05/2006 12:00AM          1,743 C.HTM02/05/2006 12:00AM          3,080 G.HTM02/05/2006 12:00AM          2,566 L.HTM02/05/2006 12:00AM          1,726 P.HTM
0 Kudos

1,510 Views
mjbcswitzerland
Specialist V

Hi Wind

TCP/IP is very simple.. on the other hand TCP/IP is massively complicated. There are many services and specialities (also implementation specialities) which have to be learned - a lot by trial and error.

Concerning FTP. I assume that you were clicking on the files in the ftp folder. Generally this is not the way to use ftp - ftp is used for copying files and not opening or executing them as when the files are shown in an explorer windows, or displayed in a http browser. The files should be copied locally, modified if require and then copied back - some things such as rename, create and so on are possible directly via FTP (by the way I am no FTP expert since I use it purely for file transfer and there are a lot of issues - including security, users, modes and loads of ofther settings which complicate  the issue).

What happens when double clicking on a file seems to depend on the browser used and it seems to take the file contents from cache and display it, if available. When I try on my Linux based FTP server, it is not possible to open a file by clicking - there is just a link timeout - but if I have copied the file previously (the browser has it in cache) it is (sometimes?) opened. Therefore I think that this issue is more browser related - with cache timeouts etc. but not really sure, I just wouldn't try to use it this way...

One note - the embedded FTP server is not designed as a full scale ftp server (this would be quite/very complicated) but only for shifting html files around. It also has only one user connection and if multiple connections are attempted, the subsequent ones will be reset. There is a two minute inactivity timeout so that it doesn't get blocked for too long by one user.

As for the fact that you can retrieve the file 0.htm but not others, I'm going to have to look into this. I hadn't seen this problem before but also saw it when testing from a distant computer today.

There is always something new to learn...

Regards

Mark
www.mjbc.ch

 

0 Kudos

1,510 Views
mjbcswitzerland
Specialist V
Hi
The Demo board is a great for learning on. If you want a kick start, get the following demo project. It will compile with the GNU compiler or can be built in an IAR project (with a few minutes extra work also with Codewarrior, which comes with the DEMO9S12NE64 as evaluation version).
In addition, and best of all, you can run the project with VisualStudio on a simulated NE64 (in real time). It will use the PC's COM port and Ethernet LAN interface and the simulated device talks to other PCs/devces on the network. You can set breakpoints in the code (for example, in interrupt routines) and watch an Ethernet frame pass through the NE64 interrupt routine, up the TCP/IP stack etc. You can learn about the NE64 by simply stepping through the code to see how it all works.
Load the compiled code to the DEMO9S12NE64 and it will run - blinking the LED you are interested in plus responding to PINGs and sending PING tests of its own - the demo's below do a lot more (dynamic http web server, FTP etc.) but take up only about 25k of NE64 code space plus 16k in page 0x3d for a file system to hold web pages which can be updated by FTP...
 
See live demos via web cam at http://212.254.22.36:8080 - log on and control device using Browser at http://212.254.22.36 (user "ADMIN" password "AL6000S") or write messages to a LCD at http://212.254.22.36:8081 (login "anon" "anon").
 
The uTasker for the NE64 (operating system, drivers, TCP/IP stack and real-time NE64 simulator) is free to educational establishments and for non-commercial use, including free email support. It includes a free serial debugger and also code to program to the DEMO9S12NE64 to turn it into an Ethernet based high speed BDM for use with your first own hardware!! Try it from your browser at http://212.254.22.36:8083 - halt a running board, step its code and look at its memory.
 
As you see, the NE64 is not only fun, it is really easy to leard and use. You can program your own Internet enabled application after only a few days study - see documents in the "documents" folder and some project instructions in the "applications\ping" project folder.
 
Have fun!
 
Regards
Mark Butcher
www.mjbc.ch
0 Kudos

1,510 Views
alex_spotw
Contributor III

Hi:

I don't know which compiler you have, but you could download the limited version of CodeWarrior and do some experiments. You can request a evaluation license too, and then have access to Processor Expert, which will facilitate the initial setup of a sample project for testing.

Let us know which toolchain you're planning to use.
Check www.processorexpert.com

Regards,

Alex

0 Kudos