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

SPI port3 on 24EP512GU810

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



Joined: 26 Apr 2010
Posts: 56

View user's profile Send private message

SPI port3 on 24EP512GU810
PostPosted: Sat Nov 10, 2012 2:19 pm     Reply with quote

Hi,

I have a project that uses three SPI ports. One of these is set as slave on spi 3:

Code:

#use spi(SLAVE, FORCE_HW, DI=PIN_D14, DO=PIN_D15, CLK=PIN_B13, BITS=8, SPI3, stream=SPI_RCB)

SPI_MOSI - PIN_D14
SPI_MISO - PIN_D15

and
Code:

#define SPI_MODE_3  (SPI_H_TO_L | SPI_XMIT_L_TO_H)
void initSPI3(void)
{
    setup_spi3(SPI_SLAVE | SPI_MODE_3);
   
   clear_interrupt(INT_SPI3);
   enable_interrupts(INT_SPI3);
}

In the code:
Code:

#INT_SPI3
void SPI_Msg(void)
{
   unsigned int8 theByte;
 
   theByte = spi_read3();
}

The interrupt INT_SPI3 was never triggered and spi_ck, spi_MOSI was captured on scope with CS signal. Everything looks OK.

My question is that, why INT_SPI3 is not triggered?
PIC24EP512GU810 and CCS ver4.134 are used.

Please help.
Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Sat Nov 10, 2012 4:17 pm     Reply with quote

#PIN_SELECT

Just as for the UART, you must use #pin_select to tell the compiler that the pin is connected to the hardware SPI _before using the #USE SPI command. Specifying FORCE_HW, doesn't make the selection happen, it just tells it to generate code for the hardware port. Without the selection, effectively the 'wiring' is not connected....

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