So after so many weeks we have come to the end and I have got the whole project working. If you have been following then in Part One we came up with the idea of making a temperature display using a LED matrix (5x8). This would be driven by a FPGA and would get its temperature from a MAX31855 SPI temperature sensor. We then looked at the blocks of code and function blocks that would go into this project.
Then in Part Two I designed and generated the separate code blocks for the function blocks in Part One. Then in Part Three I connected the blocks together. However up till then I’d not used the SPI sensor. So in Part Four I designed a SPI interface that could interface to the chip. This used a small state machine that kept the interface running and updating a interface. So now its time to get this interface working.
I think this is a very important point to say that this went very easy. The reason for that is Part Four. I had spent a lot of time designing the SPI separately and also testing it. This did not appear in the blog but simulating your design is critical. So that in this part, ‘just’ placing the code in the full project worked really well because it was well tested. Testing on a live system in FPGA without the right tools can be very hard.
So let see it working then... I placed the SPI unit into the rest of the project and changed one line of code:
--bcd(11 downto 0) <= to_bcd(cnt_r(29 downto 22));
bcd(11 downto 0) <= to_bcd(SPI_Data(28 downto 21));
Here I commented out the original line that took the counter as our data input via the BCD converter. This was replaced with data from the SPI interface.
Once compiled this just run and was even surprised myself! So below here are a few pictures of the display. Sorry images are not clear but wanted the LEDs to show up clear on the camera.
So that's it. I’ve once again copied in the full design files for people to look at and hopefully learn from. I hope that you have enjoyed reading these blog posts and have been inspired to go do some FPGA programming yourself.
If you want to follow my other blogs then please feel free to follow me on Twitter, Facebook or Google+.
Thanks for reading and if you do any projects yourself, write them up and post them here. We all want to hear how you get on.