CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

webserver

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Tagge



Joined: 23 Aug 2005
Posts: 93

View user's profile Send private message Visit poster's website

webserver
PostPosted: Tue Mar 31, 2009 5:52 am     Reply with quote

Hi, I'm wondering how I must proceed using CCS TCP/IP in my own application, I'm using a PIC18F97J60. And trying to use the ex_14.c as an platform..(simple webserver)
I just want to be able to show a small web page with some values on it.
So how do I only initiate and start the web server, just showing the web page.
I have no LCD but a working rs-232 out, and an ethernet jack.
[
Code:

void main(void){
 MACAddrInit(); //hard coded in ccstcpip.c
   IPAddrInit();  //hard coded in ccstcpip.c
   init_user_io(); // 18F97J60

   //lcd_init(); //no lcd

   StackInit(); //init stack

   while(TRUE) {
      restart_wdt();
      StackTask();
      HTTPTask();
      LCDTask(); //printing out on rs-232
   }

And my settings:
Code:
#if STACK_USE_CCS_PICEEC
 #include <18F97J60.h>//  18F67J60
 #use delay(clock=25M)
 #fuses NOWDT, NODEBUG, HS, NOIESO, NOFCMEN, PRIMARY, ETHLED
#endif
#if STACK_USE_CCS_PICEEC
 #define USER_LED1    PIN_B4
 #define USER_LED2    PIN_B5
 #define LED_ON       output_low
 #define LED_OFF      output_high
 #define STANDARD_ADC_STRING  "AN2"
 
 void init_user_io(void) { 
   *0xF92=*0xF92 & 0xFC;   //a0 and a1 output
   *0xF93=*0xF93 & 0xe7;   //ÄNDRAT TILL, B4-B5 OUT, b3, b4 and b5 output
   LED_OFF(USER_LED1);
   LED_OFF(USER_LED2);   
 }
#endif

The mac and IP init is also there.
But, I cant get anything out of my RJ-45? not even an LED blink..
I have changed all the lcd prints to the rs-232.
On the rs-232 I only get
No Ethernet
Listening

And that is beacuse it cant read/recognize the ethernet port?
The PIC is up and running, my debug led is blinking as supposed.
But do I have to make any other changes in the code?
[/code]
Tagge



Joined: 23 Aug 2005
Posts: 93

View user's profile Send private message Visit poster's website

PostPosted: Wed Apr 01, 2009 9:00 am     Reply with quote

There is no need for an external eeprom in this example?
I cant see anything to be saved on one at least..
About the hardware, I use the ordinary I/O for ethernet and LED's, and an Pulse Jack RJ-45. PIC18F97j60 at 25MHz.
Would be grateful for some good hints.
/Tagge
bsturm



Joined: 23 Feb 2009
Posts: 29

View user's profile Send private message

PostPosted: Wed Apr 01, 2009 9:40 am     Reply with quote

Are you starting with your own hardware design? There are so many potential issues, hardware and software. I find it is much easier to purchase a working demo board as a reference design. That way, you start with something that works (hopefully) and can build from it or compare your system to it. CCS sells some nice looking demo boards, as do others.
Tagge



Joined: 23 Aug 2005
Posts: 93

View user's profile Send private message Visit poster's website

PostPosted: Wed Apr 01, 2009 2:46 pm     Reply with quote

Hi, maybe you are right, but I use the Olimex layout and with the PIC18F97J60 there should not be any big issues about hw?
One thing I just figured out is that I'm having a too low VDD to my application, only 2,5V, and I noticed that the ethernet solution needs at least 3V!
Will test tomorrow with a higher VDD
Thanks/Tagge
Tested and no difference Confused


Last edited by Tagge on Wed Apr 08, 2009 12:38 am; edited 1 time in total
Jim Hearne



Joined: 22 Dec 2003
Posts: 109
Location: West Sussex, UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Apr 03, 2009 8:12 am     Reply with quote

bsturm wrote:
Are you starting with your own hardware design? There are so many potential issues, hardware and software. I find it is much easier to purchase a working demo board as a reference design. That way, you start with something that works (hopefully) and can build from it or compare your system to it. CCS sells some nice looking demo boards, as do others.


The nice looking CCS network demo board I bought unfortunately comes with TCP/IP software that has lots of bugs which they promised to fix last June and still haven't.
I never was able to get it working myself.

Jim
Tagge



Joined: 23 Aug 2005
Posts: 93

View user's profile Send private message Visit poster's website

PostPosted: Mon Apr 06, 2009 6:52 am     Reply with quote

Thats promising... And I still dont get it to work, no life what so ever on my RJ-45. Is there any issues with using the 18F97J60 and the ccs stack?
To use the ex_14.c is it enough to call for the functions I do?
In main()
Code:
while(TRUE) {
      restart_wdt();
      StackTask();
      HTTPTask();
      LCDTask(); //printing out on rs-232
   }

My rewritten LCD_Task()
Code:
void LCDTask(void) {
   static TICKTYPE lastTick;
   static enum {LCD_Display=0, LCD_Wait=1} state=0;

   switch(state) {
      case LCD_Display:
         if (!MACIsLinked()) {
            fprintf(USER,"No Ethernet\r\n");
         }
         else {
            fprintf(USER,"\f%u.%u.%u.%u\r\n", MY_IP_BYTE1, MY_IP_BYTE2,
               MY_IP_BYTE3, MY_IP_BYTE4);
         }

         if (HTTPSocket==INVALID_SOCKET) {
            fprintf(USER,"Socket Error\r\n");
         }
         else if (!TCPIsConnected(HTTPSocket)) {
            fprintf(USER,"Listening\r\n");
         }
         else {
            fprintf(USER,"\n%u.%u.%u.%u\r\n", TCB[HTTPSocket].remote.IPAddr.v[0],
                     TCB[HTTPSocket].remote.IPAddr.v[1],
                     TCB[HTTPSocket].remote.IPAddr.v[2],
                     TCB[HTTPSocket].remote.IPAddr.v[3]
                  );
         }
         lastTick=TickGet();
         state=LCD_Wait;
         break;

      case LCD_Wait:
         if (TickGetDiff(TickGet(), lastTick) >= TICKS_PER_SECOND) {
            output_toggle(USER_LED1);
            state=LCD_Display;
         }
         break;
   }
}

rest remains the original..
Shouldnt I at least get the http page to show? when trying to access the ip no. And yes, its all inside my IP no mask. But there isnt even any blink at my LEDs on the RJ-45..
/Tagge
Tagge



Joined: 23 Aug 2005
Posts: 93

View user's profile Send private message Visit poster's website

PostPosted: Tue Apr 07, 2009 12:29 pm     Reply with quote

Anyone got any idea? here is the HW schematics:
http://www.el-elektronik.net/Privat/PIC18F97J60__sch.pdf
http://www.el-elektronik.net/Privat/option_sch.pdf
Altough I think it must be in the way I use the stack?
Has anyone used it with the 18F97J60? in that case, what changes had to be made in the for ex hardware.h, ccshelper and so on..?
fuses settings?
I would be very greatful for any help, cause Im stuck Crying or Very sad
Maybe I should move over to microchips compiler or at least try it out. They made the stack, maybe thats a +??
But I love my CCS! and would feel more comfortable with it.
And everything else is working on my application, see the links.
/Tagge
picdigger



Joined: 06 Apr 2009
Posts: 7

View user's profile Send private message

PostPosted: Wed Apr 08, 2009 8:09 am     Reply with quote

I am sure that it works because I was digging through this during the last few days.

I used the CCS 4.081 with the latest CCS TCP stack V3.75 and MPLAB V8.1. Then I took the CCS example ex10a.c and
- removed all except the TCP stack
- removed all code for the eval boads (not needed but eases to find compile errors) in ccstcpip.h
- just keep STACK_USE_CCS_PICEEC TRUE in ccstcpip.h
- adopt the function init_user_io() as needed for your own board
- adjust MAC/IP/Gateway adresses in ccstcpip.h to your own environment

Then try to ping the board (don't forget to use a crossed LAN cable), it should work.

Good luck,
Jens
Tagge



Joined: 23 Aug 2005
Posts: 93

View user's profile Send private message Visit poster's website

PostPosted: Wed Apr 08, 2009 8:42 am     Reply with quote

Thanks, very happy for the help.
Im going to test it also, if possible you could maybe send me the code that you edited? then I want have any issues with that..
I still did find an HW error, there are no resistors at the RBIAS pin and no caps on the VCAP pin?¨when trying to put an 2,22Kohm at my RBIAS the 3,3V VDD drops to 2,8V, consuming to much current.. is there any issues with that pin that I should know about? and the VCAP pin?
If or when I get this project to an happy end, I will share it here on the forum. Its with GSM/GPRS, Zigbee, RTC, ext flash memory and so on.. could be to some help for others.
/Tage
picdigger



Joined: 06 Apr 2009
Posts: 7

View user's profile Send private message

PostPosted: Thu Apr 09, 2009 12:41 am     Reply with quote

I just had a deeper look into your schematic.
- Generally, there are no block Cs for the chip, might be a problem or not
- For ethernet you _have_ to add a bias resistor at pin 80, I guess it is approx. 2k2
- Where are your magnetics, hope its inside the RJ connector. If you use the AMP 0569564-3 I guess there is none inside.
- If your connector is without magnetics, please check the pinout of the RJ45, it looks a little bit strange. I guess the lines should be connected at 1-2-3-6.
- You connect VDDcore to @3V -> this is too high => abs. max. = 2,7V. Check your power supply relating to the use of the internal regulator/Vcap/EncReg/VDDcore. Also, you left ENVREG float, not sure if it will work

Please have a look inside the datasheet provided by Microchip, there you will find all you need. May be there are more issues ...
Tagge



Joined: 23 Aug 2005
Posts: 93

View user's profile Send private message Visit poster's website

PostPosted: Thu Apr 09, 2009 2:34 am     Reply with quote

Thanks, yes I have set an 2,22Kohm res at the BIAS pin, and first it didnt work, but now it seems ok for some reason. So I have managed to get a very simple webserver up and running Very Happy .
Now Im trying to get the cgi function in the webserver ex to work, it seems to take the command but I dont see it at my leds. Propably just some call missing?
And yes, the magnetics is inside the RJ-45, its an Pulse Jack J0026.
About the VDD core, at 18F97J60 its supposed to be able to handle up to 3,3V according to datasheet. Then its the question if to use the regulator?
If disabled the ENVREG should be attached to GND.. and the VDDcore to 3,3.
Should I have it enabled or disabled?
Thanks picdigger, you rock..
picdigger



Joined: 06 Apr 2009
Posts: 7

View user's profile Send private message

PostPosted: Thu Apr 09, 2009 2:46 am     Reply with quote

Congratulations :-))

In my datasheet of the PIC18F97J60 FAMILY, DS39762D, at page 415 can be found: Voltage on VDDCORE with respect to VSS...-0.3V to 2.75V. Where do you got have your information?

I use the internal regulator. VDD is 3.3V, ENVREG tied to VDD, two Caps at Vcore as depicted at page 356.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group