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

Question for 18F4431 and SSP interrupt

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



Joined: 07 Mar 2008
Posts: 28

View user's profile Send private message

Question for 18F4431 and SSP interrupt
PostPosted: Tue Apr 15, 2008 1:31 am     Reply with quote

I need the INT1 and INT2 pins of the PIC so I need the SDA and SCL pins of the SSP module to be multiplexed with the D2 and D3 pins of the controller. But when I set SSP_RD fuse and make the needed changes in the hardware the PIC doesn't go in the interrupt routine for SSP activity. But when I use the C4 and C5 pins everything works fine. Do you have any ideas ? I don't think that any piece of code is needed, but if i am wrong tell me and will post the source.
Ttelmah
Guest







PostPosted: Tue Apr 15, 2008 4:30 am     Reply with quote

The fuses appear to correctly work.
I'd look carefully at the TRIS. By default, CCS handles the TRIS settings for you. I'd suspect that setting the fuse correctly moves the lines, but CCS, is not quite 'smart enough', and is still handling the TRIS on the other register, so that the values are not set correctly for the I/O pins when used on the second port. The data sheet is also 'poor' in this regard, since it only gives the settings for the default 'portC' operation. You should write down which pins are involved, wich way the TRIS has to be set on each, and try manually setting them to these values. I suspect it'll then start working.

Best Wishes
PICoHolic



Joined: 04 Jan 2005
Posts: 224

View user's profile Send private message

PostPosted: Tue Apr 15, 2008 5:33 am     Reply with quote

I had the same SSP int problem with PIC18F2431 which is similar to 4431.
Check: http://www.ccsinfo.com/forum/viewtopic.php?t=34335

I had to configure I2C manually
sv_shady



Joined: 07 Mar 2008
Posts: 28

View user's profile Send private message

PostPosted: Tue Apr 15, 2008 6:50 am     Reply with quote

@Ttelmah I will try it as soon as I have some time.
@PICoHolic What do you mean with "I had to configure I2C manually" ?
PICoHolic



Joined: 04 Jan 2005
Posts: 224

View user's profile Send private message

PostPosted: Tue Apr 15, 2008 7:30 am     Reply with quote

Quote:
@PICoHolic What do you mean with "I had to configure I2C manually" ?


Code:

void InitI2CSlave(void)
{
   set_tris_c(0xB8);
   SSPSTAT = 0x00;
   SSPADD  = 0xE0;
   SSPCON  = 0x36;
}
sv_shady



Joined: 07 Mar 2008
Posts: 28

View user's profile Send private message

PostPosted: Tue Apr 15, 2008 2:53 pm     Reply with quote

I have tried to set the needed TRISD bits, but there was no result. I don't want to set it manually. If I have to do it I'd better use pure assembler, working with bits and bytes and writing tons of code just to use the needed pins of the I2C module. But there are many reasons not to do it...Is this bug fixed in newer or older versions or I should report to CCS ?
Matro
Guest







PostPosted: Wed Apr 16, 2008 1:30 am     Reply with quote

My advice would be to very carefully read the datasheet sections about :
- SSP overview
- I²C
- GPIO (only the 2 concerned pins)

And also to look for a silicium errata on Microchip website.

Matro.
sv_shady



Joined: 07 Mar 2008
Posts: 28

View user's profile Send private message

PostPosted: Wed Apr 16, 2008 1:59 am     Reply with quote

I don't think that reading the datasheet carefully would help. Because this is compiler bug, the SSP module works fine when using PortC pins. I have tried to set SSPMX bit manually in the CONFIG3H, but there was no result.
Matro
Guest







PostPosted: Wed Apr 16, 2008 2:25 am     Reply with quote

A simple question :
Did you have in your code the following line?
Code:

#FUSES SSP_RD

And could you confirm that the following one is NOT present?
Code:

#FUSES SSP_RC


Matro.
sv_shady



Joined: 07 Mar 2008
Posts: 28

View user's profile Send private message

PostPosted: Wed Apr 16, 2008 2:39 pm     Reply with quote

Yes I DO have this line... Here is the .h file of my project
Code:
#include <18F4431.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES HS                       //High speed osc with HW enabled 4X PLL
#FUSES NOPROTECT                //Code not protected from reading
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES BORV27                   //Brownout reset at 2.7V
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES NOWINEN                  //WDT Timer Window Disabled
#FUSES T1LOWPOWER               //Timer1 low power operation when in sleep
#FUSES HPOL_HIGH                //High-Side Transistors Polarity is Active-High (PWM 1,3,5 and 7)
   //PWM module high side output pins have active high output polarity
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES NOCPB                    //No Boot Block code protection
#FUSES LPOL_HIGH                //Low-Side Transistors Polarity is Active-High (PWM 0,2,4 and 6)
   //PWM module low side output pins have active high output polar
#FUSES PWMPIN                   //PWM outputs disabled upon Reset
#FUSES MCLR                     //Master Clear pin enabled
#FUSES FLTAC1                   //FLTA input is multiplexed with RC1
#FUSES SSP_RD                   //SCK/SCL=RD3, SDA/SDI=RD2, SDO=RD1
#FUSES PWM4B5                   //PWM4 output is multiplexed on RB5
#FUSES EXCLKC3                  //TMR0/T5CKI external clock input is muliplexed with RC3

#use delay(clock=10000000)
#use i2c(Slave, sda=PIN_D2,scl=PIN_D3,force_hw,address=0x10)

I have read all the information, concerning the problem, which I could find before writing this post.
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