Arduino shield and Due


#1

Hi, has anyone had success using the Arduino DUE with the shield?

I’ve been able to successfully get my little controller pedal working with switches, knobs and an LCD display using an Arduino UNO and the Arduino shield (as long as I’m not over-ambitious in trying to have too many actuators!). So I ordered an Arduino DUE hoping that it would be pretty much a drop in replacement for the UNO and I could then have up to 8 actuators.

I modified variant.cpp in the arduino_due_x folder to add the weak attribute as per the instructions .

But when I connect the DUE to the shield instead of the UNO the MOD DUO doesn’t recognise it at all. :frowning:

I’ve unsoldered everything from the hat just in case that should cause problems, but no joy.

Should it just work or are there other changes I need to make? This blog post give the impression that it should just work.

I’ve discovered that the standard I2C pins that I was using to drive the LCD have moved to pins 20 & 21. Has anything else changed? Do I need to recompile anything (other than my own sketch) after changing variant.cpp?

Thanks

Ian


#2

Hi,

I’d like to show you my DIY-midi-controller. It has 6 analog inputs (pedals) and 5 digital switches. It has this board inside: https://www.midikits.net/foot_pedal/foot_switch_pedal.htm

Works like a charm with the modduo.

greetings

Horst


#3

That looks great Horst!

Maybe a silly thing to say but I like that fact that it has an IEC mains input - so much better than having a separate power supply!

Useful to knwo about that midi controller board (at a good price!). I already have an old midi controller pedal (zoom 8050) that works OK, although it’s a bit big.

The main benefit for me of going down the arduino shield route is that enables me to have a display saying what controller does what (effectively a digital scribble strip). I’m a software developer by trade but not in this arena so it’s been really fun and a good excuse to get my head around the world of arduinos.

I’ve attached a pic of my second prototype, which works OK with the UNO but not with the Due.

All the best with your project!

Ian


#4

Hi @ianr
I managed to make my Arduino Due work with the MOD.
Maybe read through the posts in this thread:

The steps given by @ricardocrudo are the ones which should do the trick.
In the end it worked for me, but it’s still not super reliable and often doesn’t connect either with my configuration. But thats maybe also a problem of my code. Maybe give it a try.

Anyways, great projects you have there! Nice work!
Greetings
Matthias


#5

Hi @CharlyRebell, thanks so much for your response!

I actually referred your thread when I was building my controller but I somehow managed to miss the part where Ricardo said to change #if 0 to #if 1 in ReUART.cpp (that’s the trouble with doing these projects late at night with glass of wine!).

So it was with great hope that I just updated ReUART.cpp but sad to say it’s still not working with the DUE.

To run down what I’ve done:

  • Updated variant.cpp to include attribute((weak)); [I ended up copying the whole modified file in case I’d missed anything]
  • Changed “#if 0” to “#if 1” on line 82 of ReUART.cpp
  • Reverted #define CC_MAX_ACTUATORS to 4 just in case that made a difference
  • Removed all project cabling from my shield

Tried running the minimalist sketch (shown below - this works on the UNO).

But STILL doesn’t work. Can you think of anything I’ve missed?

BTW I’ve confirmed that the files I’ve modified are those used by the compiler by temporarily moving a bracket to make sure I get an error!

Thanks

Ian

Minimalist sketch:
#include <ControlChain.h>
ControlChain cc;
void setup() {
cc.begin();
}
void loop() {
cc.run();
}


#6

Hmm… good question…
Your steps look right, after I did all of them the due worked for me.
Maybe take a carefull look at your variant.cpp again.
It’s already quite a long time since I did these changes.

When I return to my flat I’ll see if i can finde my modified files.


#7

@ianr seems like you have done the patch correctly. However, I don’t think your minimalist sketch should work, even in the Uno, if it does, perhaps it should not. You need to create a device using cc.newDevice.

Did you try to run the Pot or Button examples in your Due Arduino?


#8

Hi @ricardocrudo, thanks for this - good point! I’ve done a check and the Uno is recognised by the Mod Duo without (and with!) cc.newDevice in the minimalist sketch. The Due doesn’t work either way.

I’ve tried the Button example and that doesn’t work on the Due.

I’ve pretty much run out of ideas now, other than trying on a completely different PC. I’ve got a linux machine and might try that by way of a complete change.

The only other thought would be if you could provide a zip of a known working set of files…but I don’t want to distract you from more important work!

Ian


#9

I’ll find some time this week and test with the Due I have here. I’ll let you know.


#10

That would be great - thanks!


#11

@ianr @CharlyRebell I’ve found a bug in the Due’s code. There is a new version of the library (v0.5.1) already released with the fix in place. I’ve tested it here with the Pot example and it’s working well. Let me know if it works for you too.


#12

Sorry to say I’ve still not been able to get it working :frowning:

I had a go during the week from my desktop PC but no joy so thought I’d have a more of a go on my laptop.

I deleted the old control chain folder, then downloaded 0.5.1 and did an “Add ZIP Library…” from the Arduino IDE.

Installed the Due board to the Arduino IDE.

Tried to compile but got an error because I hadn’t updated variant.cpp to add “attribute((weak));” - duly updated and then it complied and deployed OK.

…but still not recognised by the MOD Duo :frowning:

I see you’ve modified ReUART.cpp and it no longer has the if statement that we had to change before - is there anything else to be modified in it? Or anything else I’ve missed?

Thanks

Ian


#13

No, you no longer need to change it.

I have update the README of the library with some debugging information. Please check it out and let me know if it helps you to isolate the problem. https://github.com/moddevices/cc-arduino-lib


#14

Thanks Ricardo,

I’ve had a read through but can’t see anything I’ve missed. If it’s really just a case of downloading the new version of the controlchain library and updating variant.cpp I can’t think of what else could be different for me, unless I’ve managed to somehow damage both my DUE boards.

Given that all I ever really needed was a bit more memory I’ve just ordered a Mega - arrives tomorrow - will see how I fair with that!

Ian


#15

Did you try to run the cc-master locally and connect the arduino to your laptop via usb?


#16

Ah no! Didn’t spot the debugging info when I followed that link an hour ago! Maybe my browser cached the old page or something. Will definitely give that a try.


#17

Er, presumably this needs to be a laptop running linux?


#18

Work out-of-the-box for Linux and maybe for Mac too. For Windows you’ll need a VM, docker or perhaps this https://docs.microsoft.com/en-us/windows/wsl/install-win10.


#19

Hmm…not having much success I’m afraid. I had a go from linux (Ubuntu on an old Macbook Pro) but when I get to the /waf build stage (having installed jansson and libserialport) I get an error:

[ 3/21] Compiling lib/src/core.c
23:51:33 runner [’/usr/bin/gcc’, ‘-Wall’, ‘-Wextra’, ‘-std=gnu99’, ‘-O3’, ‘-Wall’, ‘-Wextra’, ‘-std=gnu99’, ‘-O3’, ‘-Wall’, ‘-Wextra’, ‘-std=gnu99’, ‘-O3’, ‘-fPIC’, ‘-DPYTHONDIR="/usr/local/lib/python2.7/dist-packages"’, ‘-DPYTHONARCHDIR="/usr/local/lib/python2.7/dist-packages"’, ‘…/lib/src/core.c’, ‘-c’, ‘-o/home/ianr/Desktop/cc-arduino-lib-master/cc-master-master/build/lib/src/core.c.3.o’]
[ 6/21] Compiling lib/src/msg.c
23:51:33 runner [’/usr/bin/gcc’, ‘-Wall’, ‘-Wextra’, ‘-std=gnu99’, ‘-O3’, ‘-Wall’, ‘-Wextra’, ‘-std=gnu99’, ‘-O3’, ‘-Wall’, ‘-Wextra’, ‘-std=gnu99’, ‘-O3’, ‘-fPIC’, ‘-DPYTHONDIR="/usr/local/lib/python2.7/dist-packages"’, ‘-DPYTHONARCHDIR="/usr/local/lib/python2.7/dist-packages"’, ‘…/lib/src/msg.c’, ‘-c’, ‘-o/home/ianr/Desktop/cc-arduino-lib-master/cc-master-master/build/lib/src/msg.c.3.o’]
…/lib/src/core.c: In function ‘serial_setup’:
…/lib/src/core.c:177:31: error: ‘SP_MODE_READ_WRITE’ undeclared (first use in this function)
ret = sp_open(handle->sp, SP_MODE_READ_WRITE);
^
…/lib/src/core.c:177:31: note: each undeclared identifier is reported only once for each function it appears in
…/lib/src/core.c:188:26: warning: implicit declaration of function ‘sp_get_port_usb_manufacturer’ [-Wimplicit-function-declaration]
char *manufacturer = sp_get_port_usb_manufacturer(handle->sp);
^
…/lib/src/core.c:188:26: warning: initialization makes pointer from integer without a cast [-Wint-conversion]


#20

Thought I’d try it on another machine so span-up a Raspberry Pi!
With that I get the following error when I do a sudo ./waf build:

pi@raspberrypi:~/Desktop/cc-master-master $ sudo ./waf build -v
Waf: Entering directory `/home/pi/Desktop/cc-master-master/build’
[18/20] Compiling client/src/cc_client.c
00:14:49 runner [’/usr/bin/gcc’, ‘-Wall’, ‘-Wextra’, ‘-std=gnu99’, ‘-O3’, ‘-Wall’, ‘-Wextra’, ‘-std=gnu99’, ‘-O3’, ‘-Wall’, ‘-Wextra’, ‘-std=gnu99’, ‘-O3’, ‘-fPIC’, ‘-Ilib/src’, ‘-I…/lib/src’, ‘-DPYTHONDIR="/usr/local/lib/python2.7/dist-packages"’, ‘-DPYTHONARCHDIR="/usr/local/lib/python2.7/dist-packages"’, ‘…/client/src/cc_client.c’, ‘-c’, ‘-o/home/pi/Desktop/cc-master-master/build/client/src/cc_client.c.4.o’]
…/client/src/cc_client.c:34:21: fatal error: request.h: No such file or directory
#include “request.h”
^
compilation terminated.

A bit frustrating…will try and have more of a look tomorrow…