FT900Q SPI Slave probelm

General discussion on mikroC PRO for FT90x.
Post Reply
Author
Message
San
Posts: 6
Joined: 16 Feb 2017 22:38

FT900Q SPI Slave probelm

#1 Post by San » 16 Feb 2017 22:45

HI,
I'm new to FT90x. I just bought mikromedia HMI 3.5" Cap TFT display.
Its has 2 SPI ports SPIM & SPIS ( I think master & slave). On the Mikro C help I can find Library & code for SPI master,but no examples or library use as SPI slave. I'm gonna use another mcu (SPI Master) to send the data to TFT.If anybody can help me with this would be great.

Thanks

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: FT900Q SPI Slave probelm

#2 Post by dusan.poluga » 20 Feb 2017 17:31

Hi,

In order to get SPI slave to work you would have to initialize the SPI interface that you want to use.
Then dedicate a free pin on the microcontroller for chip select. Check for the CS to go high in your main program and then do a SPI read.

Regards,
Dusan Poluga.

San
Posts: 6
Joined: 16 Feb 2017 22:38

Re: FT900Q SPI Slave probelm

#3 Post by San » 25 Feb 2017 10:45

HI
Thanks for your reply.

I want to use HMI35CTP as a SPI slave. External master sending commands to HMI35. In datasheet it has 2 SPI slave Ports, but I cant find any library or sample codes in MikroC.

Thanks

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: FT900Q SPI Slave probelm

#4 Post by dusan.poluga » 27 Feb 2017 13:18

Hi,

Libraries are located in the right side when you open our compiler in section named Library manager.
If you need a explanation about the function name you can double click on the function and a help file will open.
There is a spi library for HMI35CTP.
All example codes can be found integrated in our compiler. You can get to them while in compiler by clicking on Project\Open Examples Folder.
And when it opens you can find folders with all of the examples. Only thing you will need to change is the mcu that is located on the left side of the compiler window.

Regards,
Dusan Poluga.

San
Posts: 6
Joined: 16 Feb 2017 22:38

Re: FT900Q SPI Slave probelm

#5 Post by San » 04 Mar 2017 14:19

Hi Dusan,

I Just need to use MCP23S17 ( 3 Units) with HMI35CTP.

The first issue I got once initilaize the MCP using Expander_Init(0); or Expander Advance init the HMI stuck in very intermittently. When use the button function on TFT its freezing after few clicks. I think FT813 & MCP23S17 are both sharing same SPIM1 bus, that causing the problem. Cos they running in different CLK speeds and FT813 using the SPI bus all the time.

Then I tried to use SPI Slaves in FT900. There is no library for SPIS in MikroC. So I tried to initialize SPIS1 by accessing SFRs of FT900. I tried following codes to access SFRs , they compiling fine but nothing changing on SFRs.I used MikroProg for debug.

Method 1
SPIS1_CNTLbits.SP_IE=1;
SPIS1_CNTLbits.SP_E=1;
SPIS1_CNTLbits.SP_R2=0;
SPIS1_CNTLbits.CLK_POL=0;
SPIS1_CNTLbits.CLK_PHA=0;
SPIS1_CNTLbits.SP_R_1_0=0;


Method 2
SPIS1_CNTL=0x63;

If you can help me with how to access the SFRs would be great.

Thanks
Best Regards
San

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: FT900Q SPI Slave probelm

#6 Post by dusan.poluga » 06 Mar 2017 16:15

Hi,

Please send me your project files.

Regards,
Dusan Poluga.

San
Posts: 6
Joined: 16 Feb 2017 22:38

Re: FT900Q SPI Slave probelm

#7 Post by San » 16 Mar 2017 10:41

hi,
I changed the IC to MCP23017 . seems like its working now. I had a problem with pullup resistors as well. when I put 5.6K (that the only one I had :lol: )
the circuit hangs after few mins (or Hours). I change the value for 2.2K its solid now.

I'll pay with SPI chips later.

Thanks

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: FT900Q SPI Slave probelm

#8 Post by dusan.poluga » 16 Mar 2017 17:01

Hi,

Glad you solved this.

Regards,
Dusan Poluga.

Post Reply

Return to “mikroC PRO for FT90x General”