Home › ELEKTOR FORUMS › DigiButler (April & May 2008) › How to enable DHCP and using the TBLCF...

ELEKTOR FORUMS

Please log in to post a reply or subscribe / unsubscribe to topics

1   2     next

Topic: How to enable DHCP and using the TBLCF programmer

Author Post

jart

38 posts

Occasional Visitor
Occasional Visitor

Read post 01-09-2008 16:54

In this post I will explain how to modify and compile the digibutler source code so that it will get an IP address automatically through DHCP. I will also explain how to use the TBLCF programmer to flash the new firmware into the digibutler.

Firstly here are the files that you will need:

1. CodeWarrior for Coldfire version 7.1. This can be found here: http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=01272600610BF1

2. 071102-11.zip This can be found at http://www.elektor.com/magazines/2008/may/digibutler-(2).427814.lynkx. It is under the heading "Free downloads" as "Software."

3. setup.xml I will attach this file to the post.


The first step is to install CodeWarrior 7.1. Once this is done you need to extract the project files from 071102-11.zip. Extract all the files from 071102-11.zip into a folder. Then open the folder called "Versions CW 7.0" inside there should be another zip called SW_Main_Board_31_03_08.zip. Extract this zip and you should have a folder called SW_Main_Board, this folder contains all the project files and source code.

The directory that contains the CodeWarrior project files is ..\SW_Main_Board\build\m5223evb. In the folder m5223evb there is a file called elektor.mcp. Either drag and drop elektor.mcp into CodeWarrior or inside CodeWarrior go to File then Open and choose elektor.mcp. Now on the left in CodeWarrior you should see a directory of all the source files.

To enable DHCP you must make two changes. The first is in main.c. Open main.c by double clicking on its name in the directory (it is in the "project files" folder). Find the following code in main.c:

#if 1  
     IP_ADDRESS(192,168,0,151);
     DEF_GATEWAY(192,168,0,1);
     SUBN_MASK(255,255,255,0);       
#else  // IP: 0.0.0.0 Gateway: 0.0.0.0 Mask: 255.255.255.0    -  Now DHCP client works properly
     IP_ADDRESS(10,171,88,10);
     DEF_GATEWAY(10,171,88,254);
     SUBN_MASK(255,255,255,0);   
#endif

Delete this code and replace it with:

#if 0  
     IP_ADDRESS(192,168,0,151);
     DEF_GATEWAY(192,168,0,1);
     SUBN_MASK(255,255,255,0);        
#else  // IP: 0.0.0.0 Gateway: 0.0.0.0 Mask: 255.255.255.0    -  Now DHCP client works properly
     IP_ADDRESS(0,0,0,0);
     DEF_GATEWAY(0,0,0,0);
     SUBN_MASK(255,255,255,0);    
#endif

The next change is in ipport.h, this is found in the folder \common\ColdfireLite\headers. Find the following code:

// EMG - To enable DHCP, uncomment the line below
//#define DHCP_CLIENT     1  /* include DHCP client code */

Delete this code and replace it with:

// EMG - To enable DHCP, uncomment the line below
#define DHCP_CLIENT     1  /* include DHCP client code */

Now compile the code by going to the Project menu and choosing make or by pressing F7. Hopefully it will compile without any errors. You are now ready to flash the digibutler with new firmware.

Open the folder "TBLCF" that was in 071102-11.zip. Inside this folder extract the files from "tblcf_v10.zip". Follow the instructions in manual_v14.pdf to install the TBLCF drivers and flash the TBLCF. Once you have finish setting up the TBLCF go to the Tools menu and choose "Flash programmer" in CodeWarrior. Click on the "Load Settings" button and choose setup.xml. Now CodeWarrior is ready to flash the digibutler.

Before programming make sure that you have right jumper setting on the digibutler board. Jumper 2 should be on and pins 1 and 2 of jumper 2 should be connected.

Connect the TBLCF to the programming port of the digibutler, then plug the TBLCF into your computer, then power up the digibutler. Click on the "Erase / Blank Check" button in CodeWarrior. Click Erase and wait for a success message to appear. If the erase fails try again and if it still fails restart CodeWarrior.

Next click on the "Program / Verify" button then click on browse. Go to the folder SW_Main_Board\obj and choose web_coordinator.S19. Now click program and wait for a success message.

Now the digibutler is programmed you can run the software by going to Project then Debug or by pressing F5. If a dialogue box appears click yes. The debug window should now open. Click on the run button at the top left of this window (it is the button with an arrow and a bug on it.) You may need to press the run button twice to start the program. Alternatively if you do not want to debug just press the reset button on the digibutler board to start the program. 

Notes:

1. You must always erase the chip before programming.

2. You may need to restart CodeWarrior between each programming. This may just be a bug in my setup.

3. After programming the serial baud rate will be 115200. This can be changed in the file m5223evb.h by changing this line:
#define UART_BAUD                115200    /*  19200*/ 
Replace 115200 with the baud rate you want.

Added 2/09/2008:

4. If after programming you get the message "@@@@ LINK IS DOWN @@@@" over the serial port see this thread and find solution on second page: http://www.elektor.com/forum/elektor-forums/recent-main-projects-and-articles/no-ethernet-connection.663666.lynkx

Please reply in this topic if you have any problems and I will try to help.

Attachmentsetup.xml


Post edited by jart on 02-09-2008 12:21

avrkris

24 posts

Occasional Visitor
Occasional Visitor

Read post 01-09-2008 18:05

Hi Jart

...you saved us, thanks for the detailed info on using the setup...This should be a part of the oryginal project!

Downloading CW 7.1 43%...44%...

Thanks again
Kris

Elektor Editor

587 posts

Power User
Power User

Read post 02-09-2008 11:07

Hi Kris

you got the hang of it!
For interest, the original DigiButler firmware was developed using CodeWarrior version 6.3 (still a free download from the DigiButler project web page), with advice from Freescale to refrain from use of 7.0. Meanwhile CodeWarrior has progressed to versions 7.1 and quite recently 7.2. We will pick up on this.

Jart's detailed DHCP modification will be published on a larger scale for the benefit of all DigiButler users and aspiring ones.

The joint authors of DigiButler enjoy the response so much they've twisted arms here and there to make the TBLCF board available through the Elektor SHOP. I will announce availability through the Updates & Extra Info tab on the project page.

at yr service
Jan

Wouter1

18 posts

Popping In
Popping In

Read post 02-09-2008 22:17

@jart: what an excellent job you've done! Now I only have to build me a TBLCF to get things realy working....

Still a question: in the new code you leave the IP_ADDRESS set to 192.168.0.151. Is it possible to change it by just simply changing the code here?

Thnx again, Wouter

Post edited by Wouter1 on 02-09-2008 22:26

jart

38 posts

Occasional Visitor
Occasional Visitor

Read post 02-09-2008 22:31

Hi Wouter

The way the code works is that everything between "#if 0" and "#else" is skipped and everything between "#else" and "#endif" is included. This means that the IP address will be set to 0.0.0.0 this is the correct setting to use DHCP.

If you did want to use a static IP address you would change "#if 0" to "#if 1". Then set the IP address to whatever you want and change the DEF_GATEWAY to the IP address of your router.

Wouter1

18 posts

Popping In
Popping In

Read post 02-09-2008 23:02

@jart: thanks, all is clear te me now.

Wouter

Elektor Editor

587 posts

Power User
Power User

Read post 03-09-2008 15:15

Done it: the TBLCF board will be available soon from Elektor. See the Updates & Extra Info tab on the DigiButler (2) project page (May 2007).

I've also put the complete DHCP update procedure into the same area. We've verified it in the Elektor lab and it works a treat. The two small files needed are now an additional free download. Thanks again John.

Jan

Elektor Editor

587 posts

Power User
Power User

Read post 05-09-2008 09:21

Hi Jart (John)

for your contribution to this forum and assistance to other users you have been awarded 100 e-credits. Your balance will be updated soon.

thanks
Jan

jart

38 posts

Occasional Visitor
Occasional Visitor

Read post 05-09-2008 14:19

Hi Jan

Thank you. I hope my contributions will encourage other people to make cool additions to the digibutler.

micha_k

14 posts

Popping In
Popping In

Read post 16-09-2008 18:37

Hi Friends,

I tried to program the Digibutler with the procedure described above, but the Flash Programmer of Codewarrior just tells after klicking the Erase button: Error: Initialization failed. in the status line. The LED of the TBLCF blinks twice (resp. it's lighting green, and turns off twice) and that's it.
Im wondering that the Digibutler is also sending the known string to the UART independently if JP2 is set or not... Is this the normal behaviour of the CPU? Maybe someone has any idea what's may wrong?

jart

38 posts

Occasional Visitor
Occasional Visitor

Read post 16-09-2008 21:14

Hi micha,

Firstly, JP2 enables or disables JTAG. This only effects programming and the jumper should be on to program. Also JP1 should be in the 1-2 position.

It seems as if your TBLCF is working because of the flashing light. This mean that the problem is in the connection between the TBLCF and the digibutler or in the setting of CodeWarrior.

Try restarting your computer and trying again. If this does not help double check all the settings in CodeWarrior. Make sure you followed all the steps in this guide and in the TBLCF instructions manual.

If it still does not work check your TBLCF board for solder bridges or other problems.

Also the digibutler must be powered to program.

Post edited by jart on 16-09-2008 22:10

micha_k

14 posts

Popping In
Popping In

Read post 17-09-2008 10:40

Hi Jart,

thanx for the quick reply.

I'm experienced microcontroller user (what does not mean, that I'm doing stupid things sometimes) and I checked everything 10 times...

I also guess that the TBLCF is o.k. but maybe the µC is not in the mode to accept JTAG commands, something is wrong with the cable, missing connection or similiar things...

I'm using a 10 wire cable between TBLCF J1 pin 1-10 and Digibutler J1 pin 1-10, is this correct?

Is there a way to test the TBLCF if the firmware is loaded correctly?

micha_k

14 posts

Popping In
Popping In

Read post 17-09-2008 13:01

Hi again,

...there is no success.

I exchanged the diodes of the TBLCF with schottky types and activated the "Log Communications Data to Log Window" in the Debugger Remote Connections for the TBLCF GDI settings. Here is the Log (After this this message appears: Error: Initialization Failed.):

GDI: DiGdiOpen()
==> DI_OK
GDI: DiGdiVersion()
==> DI_OK
GDI: DiGdiGetFeatures()
==> DI_OK
GDI: DiGdiAddCallBack(8192)
==> DI_OK
GDI: DiGdiAddCallBack(16384)
==> DI_OK
GDI: DiDirectCommand(USB_DEVNO 0)
==> DI_OK
GDI: DiDirectReadNoWait()
==> DI_OK
GDI: DiGdiInitIO()
GDI: Callback(DI_CB_MTWKS_EXTENSION) kind=MTWKS_CB_REPORTONLYFATALERROR, Result=DI_OK
GDI: Callback(DI_CB_MTWKS_EXTENSION) kind=MTWKS_LEGACY_CB_COLDFIREAUTOCONFIG, Result=DI_OK
==> DI_OK
GDI: DiExecResetChild()
==> DI_OK
GDI: Writing Register: (id:6145): 0x020000000
GDI: DiRegisterWrite()
==> DI_OK
GDI: Writing Register: (id:7173): 0x020000021
GDI: DiRegisterWrite()
==> DI_OK
GDI: Writing Register: (id:7172): 0x061
GDI: DiRegisterWrite()
==> DI_OK
GDI: Writing To Memory Address: 0x040100074, count: 1, memSpace: 1
GDI: 0F
GDI: DiMemoryWrite()
==> DI_ERR_NONFATAL

micha_k

14 posts

Popping In
Popping In

Read post 17-09-2008 14:23

Hello again,

the problem is solved. My Digibutler can be erased and programmed now...

There was a missing connection between TBLCF and the Digibutler (In order to connect a 10 pin ribbon-cable-connector to J1 of the Digibutler board, I made a 10 pin adapter. Unfortunately I did not solder at 1 pin carefully enough)...

Sorry for bothering... I swear, from now on only helpful posts from my side...

hb4

5 posts

Popping In
Popping In

Read post 12-03-2009 20:31

First, I would like to thank jart for the detailed description on flashing the DigiButler. Then I will share the experience of not getting it to work in the first place. The LED blinked twice, and I got the "Error: Initialization failed", just like micha_k did, and I started to worry about my TBLCF programmer which I had just build. I checked the JTAG connections all the way from the resistor network (RN1) on the DigiButler to the 7414 on the TBLCF, and it appeared that pin 8 on the 26pin connector was not connected. The pin was soldered on one side only, but I did not think it matters. After soldering the other side as well, the programming worked, so I guess there is no through plating.

I put the jumper JP2 in position 1-2 like the description in this topic says, even though the Elektor description (May 2008, page 29) says position 2-3.

Finally a couple of questions:
1) What is the point of having JP1 and JP2? Couldn't they always be left in the "programming" position?
2) The CodeWarrior keeps asking if I wish to save the setup.xml file each time, even when I have made no changes. Any ideas why?

But these are just details, the programming works !!!

hakann

62 posts

Frequent Visitor
Frequent Visitor

Read post 13-03-2009 19:23

I also have that question each time I close the flash programmer window. Even if I startup and do no changes, it asks to save each time. Really annoying.

I tried at first to not close the Flash window and let it stay in the background, but then my Codewarrior tends to crash.

jart

38 posts

Occasional Visitor
Occasional Visitor

Read post 13-03-2009 20:14

Hi hb4,

JP2 is to choose between JTAG and BDM mode. JTAG is for testing while BDM is for programming and debugging. JP1 allows you to use either a 26 or 10 pin BDM cable.

As for the annoying save message, try closing the programmer with the cross in the top right corner instead.

hakann

62 posts

Frequent Visitor
Frequent Visitor

Read post 13-03-2009 22:06

Okey. But why would that make a difference? It should be the same thing. Or have they made anything spookie that makes it differ from an ordinary close?

In any "normal" Windows application, you'd get the same result when you use the cross button as using a close button.

hakann

62 posts

Frequent Visitor
Frequent Visitor

Read post 16-03-2009 11:26

Yes, tried that now. It does work and close window nice without messages if using "cross"-button. But I can't understand why. It should be tha same. Thanx, jart!.

Schueler

1330 posts

Power User
Power User

Read post 23-09-2010 08:57

I followed the steps and modified the code.
When I compile the code with CW 7.2 everything seems to be ok.
But...

When I start the Digibutler I only get this message:

Elektor SW Version 1.1.0

Running ColdFire TCP/IP-Lite stack

Copyright 2006 by Freescale Semiconductor Inc.
Use of this software is controlled by the agreement
found in the project LICENSE.H file.
Built on Sep 23 2010 08:47:16

Heap addr=20001C94 Heap size = 25344 bytes

The processor doesn't react at all at this point.

Who is familiar with compiling and this kind of problems?!?
I get the seem problem when I compile the original code ( for CW 7.0 ).


Ben

Please log in to post a reply or subscribe / unsubscribe to topics

1   2     next

Subscribe now

Subscribe to our free
E-weekly Newsletter!

Enter your Email address:

Follow Elektor

      

Act now!

FAQ

Before submitting questions, review our FAQ section!

Bestseller

Microprocessor Design using Verilog HDL

This book is a practical guide to processor design in the real world. It presents the Verilog HDL in an easily digestible fashion and serves as a thorough introduction about reducing a computer architecture and instruction set to practice. 

Package Deals

Elektor Bundles

Check our Package Deals and save money! Discounts up to 19% now available!

Price Slashed

Elektor OSPV

This Open Source People Vehicle is perfect for factory halls, warehouses, hospitals, colleges, schools etc.

Elektor PCBs at 25% OFF