Author Topic: MAX 31865 and PIC16F SPI  (Read 1272 times)

0 Members and 1 Guest are viewing this topic.

Offline diegobincolettoTopic starter

  • Newbie
  • Posts: 1
  • Country: it
MAX 31865 and PIC16F SPI
« on: June 15, 2024, 08:27:40 pm »
I saw a glog on the same topic by NEXUS a couple of years ago.
I'm facing the same problem, is it possible for NEXUS to share some code ?
I'm stuck with writing to the MAX 31865 and getting a response.
I read both the MAX31865 and PIC16F19326 satasheets.
I have set up the configuration for SPI communication and sent a Write command.
I can see the CD, Clock and data on SDO pin with an oscilloscope.
I understand from the MAX31865 datasheet that after sending a Read byte (A7 = 0 + address) you have to send clock pulses to the slave MAX31865 in order to get an aswer, how do you do that?
 

Offline TomS_

  • Frequent Contributor
  • **
  • Posts: 854
  • Country: gb
Re: MAX 31865 and PIC16F SPI
« Reply #1 on: June 15, 2024, 09:39:00 pm »
Every time you send a byte you will receive a byte, and that involves generating 8 clocks.

Sometimes a device needs one or two dummy bytes before it is ready to send the requested data, so just send a few more bytes as required, ignoring what ever is received until the device starts sending data. The number of dummy bytes should be detailed in the datasheet.

If it needs less than 8 clocks then you'll have to take manual control of the clock line and toggle it yourself.
 

Offline simonnavak

  • Newbie
  • Posts: 2
  • Country: us
Re: MAX 31865 and PIC16F SPI
« Reply #2 on: October 14, 2024, 02:32:19 am »
I faced a similar issue before and managed to get it working. After sending the Read byte (A7 = 0 + address) to the MAX31865, you do need to send extra clock pulses to the slave to get the response.

 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3399
  • Country: gb
Re: MAX 31865 and PIC16F SPI
« Reply #3 on: October 14, 2024, 07:06:26 pm »
You just write "dummy" bytes (e.g. 0xFF) to the MSSP module to make it produce another 8 clock pulses.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf