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

SPI differences between 18f258 and 18f2580 ?

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







SPI differences between 18f258 and 18f2580 ?
PostPosted: Tue Sep 16, 2008 7:04 am     Reply with quote

On existing hardware with 18f258 the following code works, but when recompiling with the same compiler for 18f2580 on the same hardware but with 2580 cpu of course the program halts after the second spi_write..
Code:

void main()
{

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF|ADC_TAD_MUL_0);
   setup_spi(SPI_MASTER|SPI_L_TO_H|SPI_CLK_DIV_64);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   
   spi_write( 1 );
   spi_write( 2 );
   while(1);
}


Debugging this gives that...
004E: MOVF FC9,W
0050: MOVLW 02
0052: MOVWF FC9
0054: BTFSS FC7.0 <---
0056: BRA 0054

..it gets stuck at the bit test which will never become true causing an infinite loop between address 56-54. However if I insert a microsecond delay between the writes it will work.
The data sheets between the cpus are the same for SSPSTAT register.
Can anyone shed any light on this ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Sep 16, 2008 1:57 pm     Reply with quote

I didn't see an errata for that problem in the 18F2580 errata sheet.
But Microchip may well have a bug in the MSSP for that PIC that they
haven't found yet. Here's the errata for another 18F PIC. In the
upper left corner of page 2, they tell you to add a delay between
successive writes to the SSPBUF. That's a work-around for a bug.
You have probably found a similar bug. Maybe you should report it.
http://ww1.microchip.com/downloads/en/DeviceDoc/80293a.pdf
treanla
Guest







Errata
PostPosted: Wed Sep 17, 2008 2:49 am     Reply with quote

Thanks for finding that other errata sheet, it certainly seems to exist a similar problem with 2580 as with 2510. I have reported it to Microchip.
Lets see what happens....
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