Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
spi1 and spi2
28-06-2015, 09:03 PM,
#1
spi1 and spi2
hi i'm trying use both spi port

and i'm looking for pin configuration


spi1 MASTER

sck1 pin 25 (fixed)
MOSI1 pin ???
MISO1 pin ???
SSa1 pin ??? (to sram spi)
SSb1 pin ??? (to eprom spi)

spi2 SLAVE
sck2 pin 26 (fixed)
MOSI2 pin ???
MISO2 pin ???
SS pin ??? (chip enable)


it is true that i can use any pin for assig to my miso mosi ecc.?
Reply
29-06-2015, 05:21 AM,
#2
RE: spi1 and spi2
Hi

No obviously but is very easy emulate SPI port.
If you do not need very high speed you can create how many SPI port you want.


Bye Bye, Moreno
Reply
29-06-2015, 11:49 AM,
#3
RE: spi1 and spi2
I've modified the SPI library some time ago (v11 only).
Functions available are :

SPI.init
SPI.begin
SPI.close
SPI.setPin
SPI.setMode
SPI.setBitOrder
SPI.setDataMode
SPI.setClock
SPI.setClockDivider
SPI.write
SPI.transfer
SPI.read

The first parameter of each function is the SPI module, it can be (depending on your proc.) : SPISW (SPI Software, to use any IO as MISO/MOSI pins), SPI1, SPI2, SPI3 or SPI4.

For example :

        SPI.setPin(SPISW, sda-pin, sck-pin);

        SPI.setBitOrder(SPISW, SPI_MSBFIRST);
        SPI.write(SPISW, val);

or :

        SPI.setMode(SPI2, SPI_MASTER8);                  // or SPI_MASTER16 or SPI_MASTER32 or SPI_SLAVE

        SPI.setDataMode(SPI2, SPI_MODE1);              // or SPI_MODE0, SPI_MODE2, SPI_MODE3
        //maximum baud rate possible = FPB/2
        SPI.setClockDivider(SPI2, SPI_PBCLOCK_DIV2);
        SPI.begin(SPI2);
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
01-07-2015, 03:03 PM,
#4
RE: spi1 and spi2
nice!


my pic is pic32mx270f256b (28 pin pdip)

Software part:
SPI.setMode(SPI1, SPI_SLAVE); // or SPI_MASTER16 or SPI_MASTER32 or SPI_SLAVE

SPI.setDataMode(SPI1, SPI_MODE0); // or SPI_MODE0, SPI_MODE2, SPI_MODE3
//maximum baud rate possible = FPB/2
SPI.setClockDivider(SPI2, SPI_PBCLOCK_DIV2);
SPI.begin(SPI1);

SPI.setMode(SPI2, SPI_MASTER8);
// or SPI_MASTER16 or SPI_MASTER32 or SPI_SLAVE WHAT IS THAT PARAMETER????

SPI.setDataMode(SPI2, SPI_MODE0); // or SPI_MODE0, SPI_MODE2, SPI_MODE3
//maximum baud rate possible = FPB/2
SPI.setClockDivider(SPI2, SPI_PBCLOCK_DIV2);
SPI.begin(SPI2);

Hardware part:

i2c1 -> eeprom

pin 18 -> sda
pin 17 -> sdc


SPI1 slave mode

pin 22 sck1(fixed)
pin ??? MOSI1
pin ??? MISO1
pin ??? SS1


SPI1 master mode -> sram spi

pin 23 sck1(fixed)
pin ??? MOSI2
pin ??? MISO2
pin ??? SS2


reference http://ww1.microchip.com/downloads/en/De...01168F.pdf
table 1-1 page 20

how set pin for my work?
are fixed pin?
Reply
03-07-2015, 05:09 AM,
#5
RE: spi1 and spi2
solved find pps table to asign pin Smile

i ohope to build my pinguino soon (no look with ardupic32 jtag for program bootloader Sad )
Reply
06-07-2015, 12:03 PM,
#6
RE: spi1 and spi2
http://wiki.pinguino.cc/index.php/PIC32M...no#Pin_Out
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
07-07-2015, 08:13 PM,
#7
RE: spi1 and spi2
ok! now i got it, i will use i2c2 port (i2c1 sharing pin with spi1 Sad )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)