chipKIT® Development Platform

Inspired by Arduino™

PmodDA2 and CEREBOT MX7ck - are they compatible

Created Wed, 15 Apr 2015 19:38:13 +0000 by FredCailloux


FredCailloux

Wed, 15 Apr 2015 19:38:13 +0000

I am busy trying to get my newly acquired kit to work together. The MX7 and the PmodDA2 don't seam to be 100% compatible according to the "chipKIT™ DACSPI2 Library Reference Manual". On the very first line we can read "The Digilent PmodDA2 contains two simultaneous D/A conversion channels. Digilent provides an Arduino driver library for this device that is able to access only one converter channel."

:( Its sad to find out about this after purchase. Anyway, my main intention in writing this topic is to try to find a solution to this incompatibility. Is it Hardware, is it software driver ? Can we modify the driver? can we make a wire adapter ?

I found that the PmodDA2 pin 2 an 3 are inputs as where the conventional SPI MX7 board output is pin 2 and 3 respectively OUT and IN. Can we not reconfigure the SPI pin 3 to output and amend the driver to be able to handle 2 channels. Or, if that pin 3 cannot be reassigned we can make a wire adapter to bring pin 3 of the DA2 to another output pin on the MX7 to be used as a second data channel for channel 2 of the DA2?

As anyone ever got involved with this problem? Did you find a solution ? How can I get a descent driver that will address both channels on PmodDA2?

thanks for your help

Alain


cristian.fatu

Tue, 19 Jan 2016 08:38:01 +0000

Hello,

I just found your post while looking for unanswered questions relating to Digilent hardware. Sorry you never received an answer, but I’ll pick this thread up in case you or anyone else is still encountering this issue. First of all, here is some background for this issue: As you wrote, the PmodDA2 provides two input lines corresponding to the 2 digital channels. It is a a "SPI like" communication, as it also provides pins corresponding to chip select and clock. It is called "SPI like" and not "SPI" because a it has two input lines instead of one input and one output line. The posted chipkit library is using the hardware SPI interface available on the MX7 microcontroller, which as I said has only one input line. So this is the reason why this library is able to access only one digital channel. What can be done if you want to access both channels ? I don't think that the idea of connecting the second channel using a different input is workable, as the SPI input should be obtained bit by bit (shifted left) using the SPI clock, so it's the SPI interface that should manage the input. So my point is that in order to access both channels you should use a software (bitbang) SPI, using GPIO pins. This has the major disadvantage is that it will be much slower, while using much more of your microcontroller processing power.


FredCailloux

Wed, 20 Jan 2016 05:19:51 +0000

Thank you Christian for your advice. After lots of learning and struggles I managed to build a C++class that is capable of addressing both channels on the PmodDA2. For anyone interested see: "PmodDA2 fully controled" post title. As you mentioned, speed is not the best parameter, but at least I can use my PmodDA2 as intended. My wish would be that someone experimented could refine the code so we end-up with a more efficient code that could manage the full capability of the DAC121.

I must admit it was for me quite a learning curve because proMX7 is my very first experimentation with C++ and C coding. Nevertheless, the coding adventure was worth every minute. I learned a lot. I still have a lot to learn. I am now trying to read a chip LS7366 encoder counter with my MX7. Just another crazy adventure.