CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Hardware SPI
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Sep 11, 2017 7:46 am     Reply with quote

Which PIC are you using ?

The HW SPI shows terrible waveform, which may indicate the SPI internal peripheral has been damaged ASSUMING the SW SPI picture is using the SAME I/O pins.

Without any reference I have to assume each division is 1 volt, so SPI highs re 3.++ volts ?

Also SPI bus speed is not given, but for test purposes, I'd go very slow, say 100KHz, or lower, the datatsheet of the device should say. By going slow, you can see the waveform better.

As well, send a known data stream, say '0x5A', something that you can decode visually easily, and of course connect to CS or SS as a sync.


Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Tue Sep 12, 2017 1:12 am     Reply with quote

Also, how is the PIC supplied?. What smoothing have you got adjacent to the PIC?.
Both wave-forms have horrible noise spikes on the 0v level. I think the scope sample rate is much too slow for the hardware SPI. I think the pulses shown are actually each 8bit bursts, and if they look bad massively under-sampled like this, I hate to think how bad the wave-forms really are...
Atarek



Joined: 07 Sep 2017
Posts: 9

View user's profile Send private message

PostPosted: Tue Sep 12, 2017 3:51 am     Reply with quote

I connected the SPI to a SPI bus analyser in the osculloscope, and here are the results,

Knowing that;
D0 : DO
D1 : SCK
D2 : CS

soft spi during mfrc522 communication
https://drive.google.com/open?id=0By2rhMw0TAvNazV3c25zaFN4YVU

hard spi during mfrc522 communication
https://drive.google.com/open?id=0By2rhMw0TAvNcGNFbXAzVFdDZ0E

0x5A test hardware
https://drive.google.com/open?id=0By2rhMw0TAvNSEdvRmNZWEx5c2c

0x5A test software
https://drive.google.com/open?id=0By2rhMw0TAvNSEdDemdpOUFRZ28

from the result above i came up with 2 conclusions,
1- That the DO pin of Hardware SPI is the DI pin in the software SPI,
2- the spi bus analyzer return these result (in hardware SPI) if the sample is on falling edge, and if i change it to rising edge it does not matter, (in software SPI it does not matter)

Regards,
Atarek
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Sep 12, 2017 5:32 am     Reply with quote

I can't help any further without knowing which PIC you're using and your 'test' program.

Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group