Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfaing SPI comm between 18f46k22 and 18f8722 .

Status
Not open for further replies.

deeplearns

Member level 4
Member level 4
Joined
May 19, 2011
Messages
75
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,939
Hi Friends ,

I am trying to connect and LCD module to 18F46k22 .
The LCd module which has touch screen uses the 18F8722 .
Hence I am trying to interface the 18f8722 (as master ) to 18F46k22 (slave ) .
I have been able to create the program and simulate it sucesfully usin proteus .
But when I tried it on the hardware it doesnt work at all .. no clk pulses nothing .
But now i can see some Clk pulses on and the master SDO sending pulses ..but nothing at the reciever for master that is the SDI (18f8722).
That is the Slave (18f46k22) does not send any pulses .

Can some one help with a test code ,very basic .

Thanks .
 

Can someone please give me some ideas ..
I have been able to get some pulses at the reciever too but the amplitude of pulses seem to be very low .
My slave recieves data ..And I have programmed it to blink an led upon correct data recieval ..and it works .
I have done the same for the Master .But the led does not blink at all ..I can see pulses in CRO for clk , sdo , sdi .
The only difference is the amplitude for the Master SDI or Slave SDO is too low .maybe 0.2 V when it should atleast 4.8 i guess .

Please help me ....


Thanks Again .
 

Hai did u verified the data sheet for any pull up enable is required?
 

U see without the pull up enable the clk signal and the sdo for master and sdi for slave are fine .....

I have been trying to troubleshoot the problem and have tried various things .
I removed the Connection between master SDO and SLave SDI to check if their is some problem ..nothing chnages .
THen i connected an 100k resistor betwween slave sdi and ground( externally )still same thing.
And actually i have disabled the RPBU ... because in the datasheet their isnt any such mention .
They are mentioned to be required when using Interrupt on change feature ..


Anyways thanks for a reply i feel good ..as their were no reply for many days ..And i will try to give an external pull-up instead of the external pull down .

Thanks .
 

Can u upload the port config part from ur program? I will try to go through the datasheet.

Thanks



If possible upload schematic also. I have downloaded the datasheet of the lcd module. I want to know how u r interfacing it. With lcd and touch screen 2 spi is used to communicate with 18f8722. Are u trying to communicate with this mcu with another spi? What is the power supply u use to power up? 5 or 3.3? What is the status of vtsc pin?
 
it will be good if u upload ur schematics and probably the code so that we can help u.
which platform are u using (asm, c, basic) etc.
how do u configure the port pin.
if the serial output is on portb be sure that the pullups are not enabled or better still try it on other ports. i have encountered this problem before using 16f886&7. i cant say this what is wrong yet but i am thinking its as a result of the multifunction nature of the port. so check your config and be sure are not assigning some function to the port while you expect another.

cheers
 
The LCD module i am speaking about is an module purchased from Mikroe Visual Glcd .SmartGLcd 240 * 128 and uses PIC 18f8722 as the core . Now we have programmed it to give a visual screen wherein we enter 8 byte of variable data and that should be transferred to another PIC 18F46k22 which when recieves the data will drive certain motors depending upon the value recieved .
Once the data transfer is complete then 18f8722,s job is done ...


I am right now trying to do a basic code to transmit data from Master and slave ..and if correct data recieved blink leds condition .
As I mentioned earlier the leds blink when i put condition if data recieved is greater then zero .
But when put condition data recieved is exactly what i am sending ..no blinking .
When checked in oscilloscope the data sent by master looks good but is in opposite polarity ..I can see the clock having positive polarity w.r.t ground ..but the Master Sdo are below ground in CRO ..and the master Sdi pulses too are below ground level and the voltage should be around 0.2 to 0.5 volts only .
 

Attachments

  • transmit_18F8722.txt
    733 bytes · Views: 116
  • reciev_18F46k22.txt
    756 bytes · Views: 125
  • Serial_Com_18f46k22Slave_18f8722_Master.rar
    215.2 KB · Views: 103

It is an 5 v device ,Port c bit 3 4 5 are used for ssp .. My main cocern seem to be ..1: data send shows to be in opposite polarity in CRO ..2 ...Data recieved by the master is of very low amplitude and opposite polarity..That is the Voltage of Slave SDO port is very low .What could be the reason . Also the Master actually uses 40 Mhz external oscillator and the reciever is at 64 mhz internal oscillator .
 

" Also the Master actually uses 40 Mhz external oscillator and the reciever is at 64 mhz internal oscillator "
from schematics i found that master processor frequency is set at 32mhz instead of the 40mhz u used. i ve got into a lot of issues when processor clock does not match what its in code, especially when using usarts. though i ve not simulate your circuit but try and check this and see what u will get. and i wonder why u made the slave frequency higher than that of the master. just curious.
cheers
 

    V

    Points: 2
    Helpful Answer Positive Rating
Hi guys ,I attached an external 10 Mhz crystal alongwith pll enabled which makes it 40 Mhz still no luck .
I tried to disconnect the Master SDI and Slave SDO and then I can see pulses at the Slave SDO of around 4.5 V amplitude but when I connect it to the Master SDI the signal gets atteunated .
So the slave is sending the pulses but when connected to the Master reciever problem occurs.

The same thing happens when using 64 Mhz internal clock .
 

Hi again ,

Actually I was able to make spi communicate the spi actually doe not require two UC to have same Oscillator frequency the Master clock is what controls the data transfer , but their still is a minor problem , the slave recieves the data correctly but the Master doesnt when i Put condition to blink led on a particular value recieved then it doesnt work ,
but when i give it a range ..ex for 240 ...if i say >=0 or >=100 or >=200 it does blink .

I suppose i need to check the WCOL or the SSPOV bit to alighn the data transfer or avoid collision , I could not understand how to do it from the datasheet .


Expecting Help ASAP .
Thanks .
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top