Setting up M2RET on M2

same thing with <sw_can.h> is this for Single-Wire-CAN-master?

M2RET uses a different Single-Wire-CAN library. For now use https://github.com/collin80/SW_CAN.

I am currently working on clarifying the existence of two different SWCAN libraries (I’m a few hours into the task; it takes a while to get everything reorganized organized).

auto spell correct messed my post.
I meant with sw_can.h same thing.
is this for single wire can

That’s probably a little bit of a mess right now. When I wrote M2RET there was a library called SW_CAN that had everything in it. That’s changing to use the MCP2515 library and then an add-on library that implements single wire CAN over top of the MCP2515 library but separate. I’m not sure whether that’s complete yet.

You might need to grab SW_CAN from my repos at https://github.com/collin80/SW_CAN in order to compile right now. Eventually the dust will settle around the single wire CAN libraries and then we can all switch to the official M2 libraries.

thx collin, got it to work. I’m not a pro at arduino as you can see.

A guide how to set up and use m2ret would be nice, a lot of bakers are getting their m2 within next couple of weeks.

Agreed! That is on the list of tutorials to write up sooner than later. If you wanted to give it a shot or take some screenshots while you work through the process, we’d be happy to post them up to the docs for everyone to benefit from.

Doubt a anyone cares, but for background see: JoaoDiogoFalcao/Arduino_Due_SD_HSCMI#3, JoaoDiogoFalcao/Arduino_Due_SD_HSCMI#6, macchina/M2_SD_HSMCI#6

Next couple of days, hopefully. I think I just finished but still have testing to do. If anyone wants the bleeding edge, see: https://github.com/macchina-dev/Single-Wire-CAN-mcp2515

There is definitely a need there. I’m currently working at it indirectly because once libraries settle down, the process of installing M2RET can be highly optimized by macchina/arduino-boards-sam#30. I might even start shipping M2RET with the board configuration :sunglasses:.

I’m seeing an error in both the prior version (I’d fixed the library typo myself) and the current one:

M2RET:255: error: cannot convert ‘MassStorage::Init’ from type ‘void (MassStorage::)()’ to type 'bool’
if (SD.Init) {
^

The block of code where it occurs is this, from M2RET.ino:

if (SysSettings.useSD) {
    if (SD.Init()) {
        FS.Init();
        SysSettings.SDCardInserted = true;
        if (settings.autoStartLogging) {
            SysSettings.logToFile = true;
            Logger::info("Automatically logging to file.");
            //Logger::file("Starting File Logging.");
        }
    } else {
        Logger::error("SDCard not inserted. Cannot log to file!");
        SysSettings.SDCardInserted = false;
    }
}

Any ideas? I’ve used the libraries linked to from the M2RET Github page, so I’m pretty sure I have my libs right.

The error really suggests you have a wrong version of the library. Any chance you downloaded the library more than 7 days ago? There was a [brief] period of time where M2RET started linking to the Macchina version of the library, but the Macchina version did not include all the needed changes (because it was trying to get them merged upstream first).

To avoid any ambiguity, the version to use with your M2 and with M2RET is https://github.com/macchina/M2_SD_HSMCI. (Yes, the URL at M2RET is currently different, but you will notice it redirects).

Okay, I removed the library (assuming I did the right one) and re-downloaded/re-added it, but no difference. Pasted below is more detail, including the libraries in use and their versions:

/Users/rogueshoten/Documents/Arduino/M2RET/M2RET.ino: In function ‘void setup()’:
M2RET:255: error: cannot convert ‘MassStorage::Init’ from type ‘bool (MassStorage::)()’ to type 'bool’
if (SD.Init) {
^
Using library due_can-master at version 2.0.1 in folder: /Users/rogueshoten/Documents/Arduino/libraries/due_can-master
Using library M2_SD_HSMCI-master at version 0.0.1 in folder: /Users/rogueshoten/Documents/Arduino/libraries/M2_SD_HSMCI-master
Using library due_wire-master in folder: /Users/rogueshoten/Documents/Arduino/libraries/due_wire-master (legacy)
Using library SPI at version 1.0 in folder: /Users/rogueshoten/Library/Arduino15/packages/arduino/hardware/sam/1.6.11/libraries/SPI
Using library LIN-master at version 2.0 in folder: /Users/rogueshoten/Documents/Arduino/libraries/LIN-master
Using library SW_CAN-master in folder: /Users/rogueshoten/Documents/Arduino/libraries/SW_CAN-master (legacy)
exit status 1
cannot convert ‘MassStorage::Init’ from type ‘bool (MassStorage::)()’ to type ‘bool’

6 posts were split to a new topic: Single-wire CAN (MCP2515) library

I’ll release a new version of the board configuration tomorrow (I am giving it one more day for a couple of people to get back to me regarding the changes). With the new version, running M2RET should be as simple as opening M2RET.ino and uploading.

Rogueshoten
When adding libraries from a zip file after unpacking you need to remove the -master from the end of the file name.
An alternative is to place the zip file in your library directory & use the arduino IDE & install the library from a zip file.
Check all your libraries in the library folder & remove the -master from the file name.

Tony

Version 0.2.0 of the board files has been released and the M2RET stuff works as I previously stated. Unfortunately, it only seems to work with the Macchina M2 (Beta). I am getting an error in the SD Card library when I try to compile with the Macchina M2 board.

I’ll have to try to investigate tomorrow, if no one beats me to it.

Is it similar to the one I’m getting?

Hi Adam
I have corrected the issue in Arduino_Due_SD_HSMCI.cpp.
This may raise the issue that we may need 3 defines for the Macchina (1 common define for both MacchinaM2 & MacchinaM2(Beta) __MacchinaM2) plus an additional define for each MacchinaM2 to clearley define which M2 we are compiling for i.e. _MacchinaM2_Base for the standard M2 & __MacchinaM2_Beta for the Beta version.

As it stands now if the end user selects MacchinaM2 (Beta) then M2RET will compile using Arduino_Due_SD_HSMCI.cpp using standard DUE pin assignments & not work correctly. By having 1 common define & 2 unique defines this will eliminate this error.
Your thoughts
Tony

No. But I think the error you posted may have been an additional error that was in the list, so I would not be surprised this was the root cause of your issue.

I think you might be right there that a single defines could be useful. In this particular case, I believe you set the define in the libraries header so I don’t think there is an issue between the two boards. Please correct me if I am wrong.

Hi Collin
Have completed changes to M2RET.ino, sysio.cpp & sysio.h to get ADC/DMA functioning along with M2I/O functioning optionally with or without M2_12VIO library. Have uploaded to you M2RET git for comment & possible inclusion
Appreciate your comments
Tony