Page 1 of 1
SPI Master
Posted: Thu Feb 10, 2011 3:56 pm
by Chris_Technik-Welt
Hello
In my actually project PIC18F87J11 with Flowcode V4.3.7.63 I need I2C and SPI.
SSP port 1 should be configured as an I2C port, one external EEPROM and RTC are connected to it.
SSP port 2 should be configured as a SPI port, one external Flash and SRAM and one FTDI V2dip1 are connected to it.
I have seen in /Components there is a SPI Master Component, but i cant used it in the system.
How can I configure this setup in Flowcode or what is with the SPI Master Component?
Thanks for answer
best regards
Chris
Re: SPI Master
Posted: Fri Feb 11, 2011 10:34 am
by Benj
Hello Chris,
By default the I2c and SPI components both refer to the first MSSP peripheral.
You should be able to use the code customisation features to move the SPI component to the second peripheral.
Eg where you have the register name sspstat, sspcon and sspbuf simply change these to ssp2stat, ssp2con1 and ssp2buf.
Let me know how you get on.
Re: SPI Master
Posted: Mon Feb 14, 2011 9:41 am
by Chris_Technik-Welt
Hi Ben
Thanks for your Infos.
I have change follows in "PIC_SPI_Legacy.c"
All sspstat, sspcon sspcon1 and sspbuf to ssp2stat, ssp2con, ssp2con1 and ssp2buf.
Hope this is right.
OK, how I can now define my port D4 D5 D6 and as Enable H0,H1 or H2?
I am not shure where or with witch command you choose the port B or C.
I have seen this:
//initialise spi
#ifdef MX_SPI_B
......
#ifdef MX_SPI_C
Many thanks for your help!!!!
Chris
Re: SPI Master simultaneous I2C and SPI
Posted: Tue Mar 01, 2011 10:49 am
by petesmart
Hey Ben,
I am working on a project with similar requirements using an ECIO (18F4455)... had a quick look thru the microchip datasheet and it was not obvious that that it had a second MSSP port peripheral capability. Is there any way to spoof this dual functionailty mode using another port other than port b for either SPI or I2C.
My use case is a magenetic compass / accelarometer using I2C and CAN bus to deliver data to a master node simultaneously....
may be I have to go to alternate silicon?
thanks
all the best
Pete
Re: SPI Master
Posted: Tue Mar 01, 2011 11:25 am
by Benj
Hello Pete,
The Flowcode I2C component allows you to use it in hardware or software mode. The software mode does not require a MSSP peripheral so you can basically move the component anywhere you like on the chip.
SPI can also be bit banged quite easily but the SPI legacy component does not currently support this mode of operation.