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

PIC18F87J50 SPI_2 stalls!

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



Joined: 04 Jan 2005
Posts: 224

View user's profile Send private message

PIC18F87J50 SPI_2 stalls!
PostPosted: Mon Feb 04, 2008 5:44 am     Reply with quote

Hello to all,

when using SPI 2 (hardware module):
Code:

set_tris_d(0x2F);
setup_spi2(SPI_MASTER|SPI_XMIT_L_TO_H|SPI_L_TO_H|SPI_CLK_DIV_4);

It stalls when trying to write:
Code:

spi_write(0xAA);


Any idea why? Is it a compiler (4.066) bug?
I didnt find any SPI errata related to the above mentioned microcontroller! Rolling Eyes

Thank you
Ttelmah
Guest







PostPosted: Mon Feb 04, 2008 7:21 am     Reply with quote

You are setting up SPI2. Hence you _must_ use spi_write2.
As it stands, spi_write, will try to talk to the non-configured first SPI. It will be turned off by default, so will never return 'finished' for a write transfer. Hence 'hang'...

Best Wishes
PICoHolic



Joined: 04 Jan 2005
Posts: 224

View user's profile Send private message

PostPosted: Mon Feb 04, 2008 8:01 am     Reply with quote

My mistake Embarassed

Thanks Ttelmah,
I appreciate it Laughing
Ttelmah
Guest







PostPosted: Mon Feb 04, 2008 11:17 am     Reply with quote

Anyone here, who claims _not_ to have made this sort of mistake, is lying.
Been there, got the 'T' shirt... Smile

Best Wishes
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