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 CCS Technical Support

PIC18F87K90 and TCP IP ENC28J60 not working

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



Joined: 08 Sep 2014
Posts: 20

View user's profile Send private message

PIC18F87K90 and TCP IP ENC28J60 not working
PostPosted: Thu Aug 27, 2015 12:28 pm     Reply with quote

Hello,

I have tried to make the pic18f87k90 to talk with the enc28j60 and it doesn't works.

I am using the ccs c tcp/ip stack and debugging with mplab x I find that gets stuck on StackInit in line:
Code:
LFSRSeedRand(GenerateRandomDWORD());


Here gets stuck.

If anyone can help me to get in the correct direction I will be very grateful.

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Aug 27, 2015 10:34 pm     Reply with quote

Debug inside this function, in the Helpers.c file:
Code:
GenerateRandomDWORD()

There are a couple places in there where it could possibly get stuck.
ercarlitosg



Joined: 08 Sep 2014
Posts: 20

View user's profile Send private message

PostPosted: Fri Aug 28, 2015 4:18 am     Reply with quote

PCM programmer wrote:
Debug inside this function, in the Helpers.c file:
Code:
GenerateRandomDWORD()

There are a couple places in there where it could possibly get stuck.


It's enters in a while loop, that presumably generate random seeds in one second, because there are so many iterations that I couldn't find where it gets out of the loop. But when I pause the program again it points me to the #use delay instruction on my include file.

I don't know what is it.

Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Fri Aug 28, 2015 7:51 am     Reply with quote

The #use delay gets pointed to, when you are in anything using a delay.

The function uses the ADC to generate values to seed the random number generator. There is a note that there will be problems if you have the ADC being accessed in an interrupt. In this case you need to disable interrupts before calling this function.
It uses the difference in speed of the internal ADC clock, and the system clock. It takes about half a million instruction cycles to execute, so if running in simulator, can take a long time. It should timeout if it fails. At the end of the day for debugging, you can run without the random number generator being re-seeded.

It will loop for ever, if it sees 'no entropy' from it's operation. So in a simulator, you have to deliberately introduce some change.
ercarlitosg



Joined: 08 Sep 2014
Posts: 20

View user's profile Send private message

PostPosted: Fri Aug 28, 2015 8:04 am     Reply with quote

Ttelmah wrote:
The #use delay gets pointed to, when you are in anything using a delay.

The function uses the ADC to generate values to seed the random number generator. There is a note that there will be problems if you have the ADC being accessed in an interrupt. In this case you need to disable interrupts before calling this function.
It uses the difference in speed of the internal ADC clock, and the system clock. It takes about half a million instruction cycles to execute, so if running in simulator, can take a long time. It should timeout if it fails. At the end of the day for debugging, you can run without the random number generator being re-seeded.

It will loop for ever, if it sees 'no entropy' from it's operation. So in a simulator, you have to deliberately introduce some change.


I am not in simulator.

I am with a board with the 18f87k90 and the olimex enc28j60 module.

Also I am not using adc and that function is from the unmodified ccs c tcp ip stack.

Anyway, I found an example with the old stack and I will stick with it to learn about how microchip stack works and then move to the new stack.

Thanks
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