EmbeddedRelated.com
Forums

SPI on RCM6700

Started by seecwriter June 20, 2011
There must be something I'm missing because I am not able to get SPI
to work on an RCM6700 module. I stripped just the basics out of my
app for testing, and I get no activity on any pin. According to the
6700 User Manual, the SPI clock should be on PD0, and MOSI & MISO
should be on PC0 & PC1. Using DC v10.66.

#define SPI_SER_D
#define SPI_CLK_DIVISOR 100
#define SPI_RX_PORT SPI_RX_PC

#use "spi.lib"

void main()
{
char cmd = 3;

SPIinit();

for(;;) {
SPIWrite( (void*)&cmd, 1 ); // Send Read command.
Waitfor( 100 ); // 100ms delay
}
}

Any ideas?

Steve

Steve,

I think you will need to modify brdinit() in rcm67xx.lib to configure the pins appropriately. The defines below tell the SPI lib which pins are being used but the port setup is assumed to be done at start up via brdinit.

BTW if you are using the dev kit PD1 seems to be used for an input to read S1.

Regards,
Peter

--- In r..., "seecwriter" wrote:
>
> There must be something I'm missing because I am not able to get SPI
> to work on an RCM6700 module. I stripped just the basics out of my
> app for testing, and I get no activity on any pin. According to the
> 6700 User Manual, the SPI clock should be on PD0, and MOSI & MISO
> should be on PC0 & PC1. Using DC v10.66.
>
> #define SPI_SER_D
> #define SPI_CLK_DIVISOR 100
> #define SPI_RX_PORT SPI_RX_PC
>
> #use "spi.lib"
>
> void main()
> {
> char cmd = 3;
>
> SPIinit();
>
> for(;;) {
> SPIWrite( (void*)&cmd, 1 ); // Send Read command.
> Waitfor( 100 ); // 100ms delay
> }
> }
>
> Any ideas?
>
> Steve
>

I don't use brdinit(). But it's apparent I didn't research this enough.
 
Looking through SPIinit(), it appears that it is configuring the SPI port
for an external clock, which doesn't seem right to me. Am I reading this right?
 
   i = SPI_ShCR;                // get shadow contents - should have bits
                          //    for selected Rx port
  i = ( i &~0x0C ) | SPI_MS;        // set Master vs Slave
  WrPortI ( SPI_CR, &SPI_ShCR, i | SPI_RX_PORT );

 
This copies Serial Port D control register to i.
Clears bits 2 & 3, and ORs in 0x08, setting bit 3.  With bit 2 left as zero, that is external clock mode.
 
Steve
From: petermcs
>To: r...
>Sent: Tuesday, June 21, 2011 1:08 AM
>Subject: [rabbit-semi] Re: SPI on RCM6700

>Steve,
>
>I think you will need to modify brdinit() in rcm67xx.lib to configure the pins appropriately. The defines below tell the SPI lib which pins are being used but the port setup is assumed to be done at start up via brdinit.
>
>BTW if you are using the dev kit PD1 seems to be used for an input to read S1.
>
>Regards,
>Peter
>
>--- In r..., "seecwriter" wrote:
>>
>> There must be something I'm missing because I am not able to get SPI
>> to work on an RCM6700 module. I stripped just the basics out of my
>> app for testing, and I get no activity on any pin. According to the
>> 6700 User Manual, the SPI clock should be on PD0, and MOSI & MISO
>> should be on PC0 & PC1. Using DC v10.66.
>>
>> #define SPI_SER_D
>> #define SPI_CLK_DIVISOR 100
>> #define SPI_RX_PORT SPI_RX_PC
>>
>> #use "spi.lib"
>>
>> void main()
>> {
>> char cmd = 3;
>>
>> SPIinit();
>>
>> for(;;) {
>> SPIWrite( (void*)&cmd, 1 ); // Send Read command.
>> Waitfor( 100 ); // 100ms delay
>> }
>> }
>>
>> Any ideas?
>>
>> Steve
>
Never mind. I missed a define in spi.lib. The serial port is being
set to internal clock.
 
Thanks,
Steve

From: Steve Trigero
>To: "r..."
>Sent: Tuesday, June 21, 2011 7:45 AM
>Subject: Re: [rabbit-semi] Re: SPI on RCM6700

>I don't use brdinit(). But it's apparent I didn't research this enough.
>
>Looking through SPIinit(), it appears that it is configuring the SPI port
>for an external clock, which doesn't seem right to me. Am I reading this right?
>
>   i = SPI_ShCR;                // get shadow contents - should have bits
>                          //    for selected Rx port
>  i = ( i &~0x0C ) | SPI_MS;        // set Master vs Slave
>  WrPortI ( SPI_CR, &SPI_ShCR, i | SPI_RX_PORT );
>This copies Serial Port D control register to i.
>Clears bits 2 & 3, and ORs in 0x08, setting bit 3.  With bit 2 left as zero, that is external clock mode.
>
>Steve
>From: petermcs
>>To: r...
>>Sent: Tuesday, June 21, 2011 1:08 AM
>>Subject: [rabbit-semi] Re: SPI on RCM6700
>> 
>>Steve,
>>
>>I think you will need to modify brdinit() in rcm67xx.lib to configure the pins appropriately. The defines below tell the SPI lib which pins are being used but the port setup is assumed to be done at start up via brdinit.
>>
>>BTW if you are using the dev kit PD1 seems to be used for an input to read S1.
>>
>>Regards,
>>Peter
>>
>>--- In r..., "seecwriter" wrote:
>>>
>>> There must be something I'm missing because I am not able to get SPI
>>> to work on an RCM6700 module. I stripped just the basics out of my
>>> app for testing, and I get no activity on any pin. According to the
>>> 6700 User Manual, the SPI clock should be on PD0, and MOSI & MISO
>>> should be on PC0 & PC1. Using DC v10.66.
>>>
>>> #define SPI_SER_D
>>> #define SPI_CLK_DIVISOR 100
>>> #define SPI_RX_PORT SPI_RX_PC
>>>
>>> #use "spi.lib"
>>>
>>> void main()
>>> {
>>> char cmd = 3;
>>>
>>> SPIinit();
>>>
>>> for(;;) {
>>> SPIWrite( (void*)&cmd, 1 ); // Send Read command.
>>> Waitfor( 100 ); // 100ms delay
>>> }
>>> }
>>>
>>> Any ideas?
>>>
>>> Steve
>>