0
\$\begingroup\$

NOTE: I am newish to FPGA programming. I have only taken 1 university course for it. I am looking for direction on where to start, not for someone to do it for me.

I bought a MAX31855 k-type thermocouple ADC amplifier. I want to hook it up to my FPGA (Altera DE0) through the GPIO pins. Adafruit has some code they've written to implement it. Their code is written for someone using an arduino board. Looks pretty straight forward if I had an arduino, but I dont. I am wondering what this code is written in. Doesnt look like verilog.

https://github.com/adafruit/Adafruit-MAX31855-library/blob/master/Adafruit_MAX31855.cpp

Would I be to cut and paste that? If not, does anyone have info on where to start with this?

\$\endgroup\$
1
\$\begingroup\$

The ".cpp" at the end of the filename gives you a clue. It's C++, which is what you program an Arduino in.

You can use that as a starting point in understanding the workings of the MAX31855 only. There is no code there that can be run on an FPGA without first implementing an entire CPU, RAM, Flash, peripherals, etc.

Things you will need to implement in your FPGA:

  1. A master SPI interface
  2. An interface to your chosen display
  3. Some process to request the data from the MAX31855 using the SPI interface and display it through your display interface.

You can use the C++ code as a "guide" for how to get the data from the MAX31855, and convert it to an actual temperature, but that's all.

For these kind of things an MCU is often a better choice, and implementing a NIOS II core may be a more desirable option than trying to do it all in Verilog or VHDL.

\$\endgroup\$
  • \$\begingroup\$ Do you have a source to start on the SPI interface? \$\endgroup\$ – MathWannaBe456 Dec 18 '16 at 15:49
  • 2
    \$\begingroup\$ Have you discovered OpenCores.org yet? If not then you need to. \$\endgroup\$ – Majenko Dec 18 '16 at 15:59
  • \$\begingroup\$ I just want to make sure. SPI can be strictly written in software correct? I don't need specific SPI ports to communicate with the ADC I bought, I can use the GPIO pins for that, correct? The more I am reading the more confused I am getting. \$\endgroup\$ – MathWannaBe456 Dec 18 '16 at 16:14
  • 2
    \$\begingroup\$ You are using microcontroller terminology to talk about an FPGA. It makes no sense. There is no software. There is only hardware. You describe the hardware in a hardware description language (HDL). In an FPGA there is no such thing as GPIO. There are only pins. You connect pins to your described hardware. SPI is itself just a glorified full-duplex shift register. \$\endgroup\$ – Majenko Dec 18 '16 at 16:18
  • \$\begingroup\$ I'm sorry. I understand what I need now. The Max31855 has no MOSI. So I have 3 things to worry about, SCK(which seems as simple as just sending my FPGA's clock to that GPIO), the MISO (to get the temperature readings from Max31855) and the SS, which tells the MAX31855 when to send the data. I am going to leave the SS high until a few microseconds before the SCK and at the posedge of the clock send the data. Sound right? May I speak with you in private chat? \$\endgroup\$ – MathWannaBe456 Dec 18 '16 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.