• AVR Freaks

Helpful Replyenc28j60 and pic18f4620 example project?

Author
gokhan60
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2013/05/02 01:35:03
  • Location: 0
  • Status: offline
2013/05/02 01:47:46 (permalink)
0

enc28j60 and pic18f4620 example project?

hi,
"C:\Microchip Solutions v2012-10-15\TCPIP\Demo App" I am can't compiled the project.
Because, I can not  select xc8. Employee have a simple example?
 

post edited by gokhan60 - 2013/05/03 01:14:11
#1
RISC
Super Member
  • Total Posts : 5778
  • Reward points : 0
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/03 15:09:32 (permalink)
5 (1)
Hi,
 
TCP/IP libraries have been historically written for C18 compiler. Easiest way is to download the latest free version of the C18 compiler and install it. You can find it here : http://www.microchip.com/compilers
 
regards
#2
maxruben
Super Member
  • Total Posts : 3397
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/04 00:47:26 (permalink) ☄ Helpfulby KSK1006 2016/10/28 00:26:19
5 (3)
First of all you have to make sure that your processor is suitable for the TCPIP stack regarding ram and flash memory size.
 
Since there is no demo board using this processor the Demo App project does not have a ready made build configuration for it. This means that you have to make your own, which is true for most custom made boards.
 
First of all, go into the Configs subdirectory of the TCPIP Demo app. There you can see two types of files for the different build configurations (demo boards). One starts with HWP and the other with TCP. These are the configuration files used to configure your hardware (HWP) and the different TCP/IP protocols, memory type and size to use for ram and storage for web pages and basic TCP/IP settings (TCPIP).
 
Make a copy of the files that most closely matches your hardware and TCP/IP requirements and rename them to something appropriate for your configuration. "HWP_C18_ENC28.h" and "TCPIP_C18_ENC28.h" for example.
 
Now you can go into MPLABX and in the dropdown list for the different build configurations, go all the way down and select Costumize...
 
The project properties dialog for all build configurations are opened. Click the Manage Configurations... button. Select a configuration and click the Duplicate button. Now select the newly created configuration and click the Rename button and rename it. With the renamed configuration still selected, finally click the Set Active and OK buttons.
 
Then you get back to the project properties dialog for the newly created configuration. Change the processor, hardware tool (debugger/programmer) and compiler tool chain to the ones you wish to use.
 
Still in the project properties dialog, select the compiler in your configuration tree in the categories list to the left. This will show the options for the compiler which is a bit different depending on the compiler you want to use. In the General category look for the Preprocessor macro definitions field. This is now set to the value for the configuration you copied. Change this to CFG_INCLUDE_C18_ENC28 for example. Set the same symbol for the assembler options.
 
Now close the project properties dialog with the OK button.
 
Go into the project panel, expand the header files and open HardwareProfile.h. Scroll down to where it says:
#if defined (YOUR_BOARD)...
Change YOUR_BOARD to CFG_INCLUDE_C18_ENC28 and the following line to #include "Configs/HWP_C18_ENC28.h"
 
Open the HW Config folder in the project pane, right click it and select Add Existing Item... in the context menu that opens. Select the HWP_C18_ENC28.h file. Now you should also exclude this file for all other project configurations (which is a pit of a pain). You have to change to all other build configurations (with the drop down list), right click the file, select properties and check the Exclude from build checkbox.
 
Open your hardware profile header file (HWP_C18_ENC28.h). Somewhere at the top there is a macro definition for the hardware setup. Change this to something for your hardware, PIC18_MYBOARD for example. Now you have to change all hardware definitions and #pragma config settings to match your hardware. Use the PIC18_MYBOARD in the main.c file to add code that is only used for your hardware.
 
Open the TCPIPConfig.h file. Add a #if defined(CFG_INCLUDE_C18_ENC28) and in the row following that: #include "Configs/TCPIP_C18_ENC28.h" and change the #if to #elif in the following row.
 
Open TCPIP Config folder under Header Files in the project panel and add the TCPIP C18 ENC28.h file to the project and exclude it from all other build configurations.
 
Open the TCPIP_C18_ENC28.h file and change it for your TCPIP requirements.
 
Of course, the filenames I have chosen here doesn't have to be these but can be anything you like.
 
Good Luck / Ruben
 
 
 
 
 
 
#3
thrghost
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2013/05/10 16:19:11
  • Location: 0
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/10 16:26:56 (permalink)
0
hi,
 
Could you please, Give a snapshot screen for the steps to compile a tcp/ip project with any special board that has a pic18f458 for example.
 
Thanks in advance
#4
RISC
Super Member
  • Total Posts : 5778
  • Reward points : 0
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/11 10:32:53 (permalink)
5 (1)
Hi,
You can forget the PIC18F458 because it does not have enough FLASH memory...( Additionally, this is a very old PIC.
Check the TCP/IP documentation. It shows for each project how much FLASH & how much RAM is necessary for each configuration.
You'll find the documentation here :
c:\microchip_solutions_v2013-02-15\Microchip\Help\TCPIP Stack Help.chm
 
regards
#5
pdavies
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2013/05/17 14:08:37
  • Location: 0
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/17 14:17:02 (permalink)
0
You are awesome. It's my first time working with microchip after moving from Arduino to MPLab and your instructions got me up and running with a pic32, wifi, and the a modified generic TCP demo in no time. Of course, after I spent a  few days racking my head. Thanks for the help.
#6
thrghost
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2013/05/10 16:19:11
  • Location: 0
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/17 16:13:54 (permalink)
0
"you have to change all hardware definitions and #pragma config settings to match your hardware"
could you please explain,do i will open all the files and look for hardware and #pragma and change it?!!!
 
Regards,
#7
maxruben
Super Member
  • Total Posts : 3397
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/18 00:19:12 (permalink)
0
thrghost

"you have to change all hardware definitions and #pragma config settings to match your hardware"
could you please explain,do i will open all the files and look for hardware and #pragma and change it?!!!

Regards,


No, that is what the hardware definition files are for. It is only in one file.
 
/Ruben
 
#8
thrghost
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2013/05/10 16:19:11
  • Location: 0
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/25 05:34:18 (permalink)
0
will i need  EEPROM to hold the webserver ?
 
#9
DarioG
Allmächtig.
  • Total Posts : 54081
  • Reward points : 0
  • Joined: 2006/02/25 08:58:22
  • Location: Oesterreich
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/26 13:14:04 (permalink)
0
Usually yes - using internal Flash is not practical (and especially on a small PIC18 not doable), or you can opt for a SDcard

GENOVA :D :D ! GODO
#10
maxruben
Super Member
  • Total Posts : 3397
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/05/26 23:22:55 (permalink)
5 (1)
You can go with an SPI FLASH instead. They cost about the same as the EEPROM but have a lot more memory. It is a bit harder to do random writes to a FLASH memory but that doesn't matter if it is only used to store the web pages (and one page for AppConfig).
 
/Ruben
 
#11
DandyDon
Junior Member
  • Total Posts : 96
  • Reward points : 0
  • Joined: 2005/01/21 09:37:33
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/10/18 12:46:08 (permalink)
0
Ruben,
 
I am using MPLAB X v1.90, XC32 v1.21, & the chipKIT Max32-chipKIT Network shield-chipKIT Basic I/O shield stack.
 
I modified the files like you described here & added the HWP & TCPIP files in the right place.  I changed the preprocessor macros to match the files I'm using.  The compiler still shows an error:
 
#error Missing project macro definition to select proper TCPIPConfig.h

 
I double checked the configuration files & they look right.  I have never messed with preprocessor macros so I'm not sure I got it right.  Can you provide more information or some suggestions, please?
#12
maxruben
Super Member
  • Total Posts : 3397
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/10/19 00:22:46 (permalink)
0
This means that there is no match in the #if/#elif defined list in TCPIPConfig.h for any preprocessor macro. So either the preprocessor macro for your board isn't defined (but then the HardwareProfile.h would show a similar message) or that you have not added your own #if defined(<your preprocessor macro>) at the top and there included you own tcpip config header file.
 
The TCPIPConfig.h doesn't have #if defined(YOUR_BOARD) at the top like the HardwareProfile.h so you have to add your own for your board. Add the #if defined(<your preprocessor macro>) at the top and change the previous first #if defined to #elif defined. I think you could get this error message if you don't change the previous first #if to an #elif.
 
The preprocessor macro is defined in the project property for this build configuration: Right click your project -> Properties -> Select the compiler for your build configuration in the categories tree to the left -> Select Preprocessing and messages in the Option categories: drop down list -> Add your build configuration macro to the Define C macros option.
 
In MPLABX you should clearly see which part for a conditional compilation preprocessor statement (#if/#elif/#else) is actually used since all the others are grayed out. Only the one used is printed in the normal editor colors.
 
/Ruben
 
 
 
#13
leonard30
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2010/01/29 09:46:40
  • Location: Rio de Janeiro, Brazil
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/10/31 07:46:15 (permalink)
0
Hi All
I made the changes as explained above by Ruben, but i did not get success to compiler the tcp/ip stack in Demo App .
Always, I get a error message [1099]: GetInstructionClock() must be defined.
 
Can anyone help me ?
 
Thx
Leonardo
#14
maxruben
Super Member
  • Total Posts : 3397
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2013/10/31 09:22:07 (permalink)
0
This needs to be defined by you to reflect your clock settings. This should be done in the hardware profile for your board. It looks like this for my 80MHz PIC32:

// Clock frequency values
// These directly influence timed events using the Tick module.  They also are used for UART and SPI baud rate generation.
#define GetSystemClock()  (80000000ul)   // Hz
#define GetInstructionClock() (GetSystemClock()/1) // Normally GetSystemClock()/4 for PIC18, GetSystemClock()/2 for PIC24/dsPIC, and GetSystemClock()/1 for PIC32.  Might need changing if using Doze modes.
#define GetPeripheralClock() (GetSystemClock()/1) // Normally GetSystemClock()/4 for PIC18, GetSystemClock()/2 for PIC24/dsPIC, and GetSystemClock()/1 for PIC32.  Divisor may be different if using a PIC32 since it's configurable.

 
/Ruben
 
#15
mickster56
Starting Member
  • Total Posts : 39
  • Reward points : 0
  • Joined: 2016/12/13 20:08:27
  • Location: 0
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2017/01/06 18:42:31 (permalink)
0
maxruben



Still in the project properties dialog, select the compiler in your configuration tree in the categories list to the left. This will show the options for the compiler which is a bit different depending on the compiler you want to use. In the General category look for the Preprocessor macro definitions field. This is now set to the value for the configuration you copied. Change this to CFG_INCLUDE_C18_ENC28 for example. Set the same symbol for the assembler options.

Good Luck / Ruben




Could you please describe what you mean in the Bold as I am not sure what to do there.
I'm using pic32
#16
maxruben
Super Member
  • Total Posts : 3397
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re:enc28j60 and pic18f4620 example project? 2017/01/07 03:13:40 (permalink)
3 (1)
mickster56
maxruben



Still in the project properties dialog, select the compiler in your configuration tree in the categories list to the left. This will show the options for the compiler which is a bit different depending on the compiler you want to use. In the General category look for the Preprocessor macro definitions field. This is now set to the value for the configuration you copied. Change this to CFG_INCLUDE_C18_ENC28 for example. Set the same symbol for the assembler options.

Good Luck / Ruben




Could you please describe what you mean in the Bold as I am not sure what to do there.
I'm using pic32


The way the compiler knows which configuration header files to include is with a macro and conditional compilation depending on which project configuration you are currently using.:

#if defined macro_name_for_your_configuration
  #include header_file_for_your_configuration.h
#elif defined macro_name_for_other_configuration
  #include header_file_for_other_configuration.h
...

The macro name gets set on the compiler command line when the compiler is run. You set the macro name in the project properties for your project, xc32-gcc options, Preprocessing and messages option categories, Preprocessor macro option.
 
/Ruben
#17
Jump to:
© 2020 APG vNext Commercial Version 4.5