0

I am new to pic32 controller, I want to interface pic32mx795f512l with DS3234 using SPI. Can anyone guide me, how to do exactly? I have gone through data sheet of both.

1 Answers1

0

Take a look at the datasheet for the timing diagram: https://datasheets.maximintegrated.com/en/ds/DS3234.pdf Then take a look at the Family Reference manual for PIC32 SPI section. (Google it) you'll need to setup a SPI bus on the PIC and write data to it, start at the low-level and use the registers, not Harmony. I don't believe myself or anyone here is going to do it for you, I could have it running in about 10 min if I had the part.

blsmit5728
  • 434
  • 3
  • 11
  • Thanks for writing back. Actually I have gone through both and developed code accordingly. Problem arises in reading data from RTC, Upon Interfacing, while I run the code, in SPIxBUF, I am getting only 0x0FF value in it. Don't know where I am mistaking so. If you want, I can post entire code here. – krunal solanki Jun 19 '17 at 06:51
  • Verify power on the RTC chip, and check that your chip selects are pulled at the right time. Verify you've set up the SPI peripheral in 16 or 32 bit mode accordingly. There is also CKS and CKP which is the clock sample edge and the clock polarity. Verify those are correct as well. Everything I've said here is in SPIxCON. – blsmit5728 Jun 20 '17 at 10:07
  • Thanks for writing back. I am using 8-bit mode by clearing mode-16 and mode-32 bits. I am using SPI mode-3 communication. Here I am attaching SPIxCON register settings. – krunal solanki Jun 20 '17 at 11:48
  • SPI1CONbits.FRMEN = 0; SPI1CONbits.SIDL = 0; SPI1CONbits.DISSDO = 0; SPI1CONbits.MODE16 = 0; SPI1CONbits.MODE32 = 0; SPI1CONbits.CKP = 1; SPI1CONbits.CKE = 0; SPI1CONbits.SSEN = 0; SPI1CONbits.MSTEN = 1; SPI1CONbits.SMP = 1; SPI1CONbits.ON = 1; – krunal solanki Jun 20 '17 at 11:49
  • Verified power, Vcc > Vpf(Power fail voltage) and Vcc < Vbat(Battery Voltage). Vcc = 3.3v. Vbat = 3.5v. Vpf = 2.5v (approx). Chip select logic I am pulling at right time. – krunal solanki Jun 20 '17 at 11:52
  • Do you have access to a logic analyzer or OScope to watch what is going on? It may be that you've got something set wrong. For a read you actually clock 16 bits, 8 in and 8 out, make sure your clock is still running and you're not pulling CS high between those. – blsmit5728 Jun 21 '17 at 14:20