|
|
View previous topic :: View next topic |
Author |
Message |
kongfu1
Joined: 26 Apr 2010 Posts: 56
|
SPI port3 on 24EP512GU810 |
Posted: Sat Nov 10, 2012 2:19 pm |
|
|
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: 19536
|
|
Posted: Sat Nov 10, 2012 4:17 pm |
|
|
#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 |
|
|
|
|
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
|