View previous topic :: View next topic |
Author |
Message |
Thorsten Guest
|
SPI Timer2 CLK doesn't work if SPI_H_TO_L is set |
Posted: Sat Feb 28, 2009 12:40 pm |
|
|
Hi,
I'm using a PIC18F24J10 and i need a max. 70kHz SPI Clock. The PIC have a 10MHZ ocsillator. So I decide to use the Timer2 as SPI Clock source. But that works only if the SPI is set to SPI_L_TO_H but not on SPI_H_TO_L. I am using 4.057.
Could anyone help me on my problem?
Thorsten |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Feb 28, 2009 4:54 pm |
|
|
What chip are you using as the SPI slave ? Normally, the data sheet
for the slave chip will specify the required SPI mode. The SPI mode will
be one of these four modes:
Code: | // SPI modes
#define SPI_MODE_0 (SPI_L_TO_H | SPI_XMIT_L_TO_H)
#define SPI_MODE_1 (SPI_L_TO_H)
#define SPI_MODE_2 (SPI_H_TO_L)
#define SPI_MODE_3 (SPI_H_TO_L | SPI_XMIT_L_TO_H) |
Normally we prefer to use these constants for the SPI mode, instead
of using "SPI_L_TO_H", etc., because it's easier.
Post a link to the web page for the SPI slave chip.
There is an errata on using Timer2 as the source for the SPI clock
for some PICs. I don't see this bug listed on the errata sheet for
the 18F24J10, but it still could be present (but not admitted yet by
Microchip). |
|
|
Thorsten Guest
|
|
Posted: Sun Mar 01, 2009 1:08 am |
|
|
Hi,
i´m using a QT1106 Wheel IC. Please google for the Datasheet because i can´t post the link (GUEST Acount ) The SPI Mode must be Mode 3. Any more suggestions?
Thanks fpor help.
Thorsten |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Thorsten Guest
|
|
Posted: Sun Mar 01, 2009 2:02 am |
|
|
Yes, i use this setting. I just tried it on a PIC18F87J10 with the same result.
I will try it now on a PIC16. I will inform you about the result.
Anymore Hints?
Greetings
Thorsten |
|
|
Thorsten Guest
|
|
Posted: Sun Mar 01, 2009 2:21 am |
|
|
On a PIC18F452 it works. |
|
|
|