SPI Master on RCM5400W

hi all

I recently purhased an RCM5400W module with a RCM4000 prototype board. I’ve been trying to write an SPI Master dynamic C program using SPI.LIB and having some problems.

Here is my code:

#class auto
#use RCM54xxW.LIB

#define SPI_SER_B
#define SPI_CLK_DIVISOR             100
#define SPI_RX_PORT                  SPI_RX_PC

#use "spi.lib"

void main()
{
  char tx[3];
  char rx[2];
  
  tx[0] = 'A';
  tx[1] = 'B';
  tx[2] = 'C';

  brdInit();
  SPIinit();
  while(1)
  {
    BitWrPortI(PBDR, &PBDRShadow, 0, 7);
    SPIWrite(tx, 3);
    SPIRead(rx, 2);
    BitWrPortI(PBDR, &PBDRShadow, 1, 7);
  }
}

So I believe I’ve configured the following:
PB7 = CS
PB0 = CLK
PC4 = MOSI
PC5 = MISO

When I monitor the 4 pins from the scope, I can only see PB7 brought low and PB0 toggling. However, I don’t see PC4 moving at all. What’s wrong with my code?

Thanks in advance.

Hi,

I have the same problem with SPI on Port B as you. Did you find the solution?

I’ll be really gratefull if you answer me.

Best regards

Hi Carmen,

That was awhile ago. If I recall correctly, I modified the SPI.LIB to make it work. Check the 2 attached file against the original SPI.LIB.

Hi,

For my module, SPI1.txt is perfect, now SPI is working properly.

Thank you very much

Carmen

I am having this same problem and cannot access the file.

Could someone please re-up the file or post the changes made?

Thanks!

Anyone has the zip file?..Pls help…

Hi all,

Any kind soul would help me in the following: i am using 5600w and believe i have configured the following:
PB7 = CS
PB0 = CLK
PC4 = MOSI
PC5 = MISO
Using the new SPi.lib posted here… the SPIwrite is perfect, writing 0xa,0xb,0xc. But at the receiver, i am unable to print out the data received.
This is my coding and i do not know where went wrong and i don’t know if the SPI is reading in the data im writing unless i do a printf:

#define SPI_SER_B
#define SPI_RX_PORT SPI_RX_PC
#define SPI_CLK_DIVISOR 100
#define SPI_MASTER
#use “SPITecnalia.LIB.lib”
#use “rcm56xxw.lib”

char rx[3];
void main()
{
brdInit();
SPIinit();
while(1)
{
SPIRead(rx,3); <===
printf("Received:%b
",rx[2]); <===
}
}

Any advices? Thank you!

Rds
drngsh