Arduino library vs faux-Arduino ATmega1284P

Is the CayenneMQTT Arduino library, in theory or confirmed reality, compatible with ANY Arduino-like Atmel AVR that has a valid Arduino board definition and access to the Arduino libraries? Or does it support ONLY specific, canonical Arduino boards that it can unambiguously identify (eg, Uno, Leonardo, Mega, etc)?

I’m currently trying to get the library to work on a “fake” breadboarded Arduino using an Atmega 1284P with Optiboot & Mightydevice “1284” board definition, and a W5100-based ethernet shield (v6, I believe) wired as follows:

SCK/MISO/MOSI/SS connected to 1284p physical pins 8, 7, 6, 5 (mapped to “Arduino” digital pins 7, 6, 5, 4 by the board definition)

RST, +5v, +3.3v, and Ground connected to the applicable pins on the MCU and breadboard (I’m getting 3.3v from the CP2103 USB-to-serial interface).

As you’ve probably surmised… it’s not working. The exact same code DID work ~2 days ago on a Mega2560 with the same ethernet shield (stacked directly).

I noticed that there’s a class – DetectDevice.h – that appears to try identifying a specific CPU and board when assigning values to INFO_CPU and INFO_DEVICE. There’s an entry for “ATmega1284”, but NOT an entry for “ATmega1284P”.I’m not sure whether this means INFO_CPU is getting defined to “ATmega1284”, or remaining undefined. Likewise, since there’s no matching board definition, I believe INFO_DEVICE is ending up with its default value “Arduino”.

So… in theory, should the library still work anyway since the AVR microcontroller ITSELF handles SPI communication (and the board definition presumably has constant definitions for the port and pins used by MISO/MOSI/SCK/SS in case the program needs to know where they are)? Or if DetectDevice ends up being unable to detect the board type & ultimately sets “INFO_DEVICE” to “Arduino”, will Cayenne fail to work?

I know at this point that there’s at least as much of a chance that it’s failing to work due to something I did (or failed to do) as there is of it failing because I’m not using a canonical Arduino board, but I just want to make sure it SHOULD (at least theoretically) be working before I spend too much time trying to figure out why it’s not.

For what it’s worth, the exact same code worked flawlessly when the same ethernet shield was plugged into an Arduino Mega2560 board. Unfortunately, the Mega2560’s bootloader appears to have corrupted itself (the USB serial port that shows up in Windows 10 device manager claims to be functioning properly, but the Arduino IDE can no longer upload code to the board, Serial monitor shows no output at all, and the code that was flashed to the board prior to it becoming dysfunctional no longer appears to be starting up), so I had to find something else in my possession with enough I/O pins and flash & cobble it together into a fake Arduino to avoid being stalled dead all weekend.

I DO actually have a non-shield Wiznet 5100 breakout board in my possession I could try, but it’s kind of a pain to use (unlike the shield, it’s 3.3v only, so I have to screw with 5v<->3.3v level shifting to use it… and it has 2mm spacing, so Dupont connectors don’t quite fit unless I bend the pins). Before I try using it instead, I want to make sure that the Cayenne library COULD conceivably work with my current setup, and that it’s not going to just blindly give up without even trying to launch upon realizing that it’s not running on a canonical Arduino board.

for this have a look at this https://www.arduino.cc/en/guide/troubleshooting

tagging @jburhenn for this.

@jeff-cayenne Yes, in theory, the Cayenne library should support the valid board definitions with access to Arduino libraries. It’s possible there could be issues with some as we have not tested the library with every different board definition. Though I would imagine there would be errors during the build if it were incompatible. If you are able to build and upload then it seems like it should work.

You don’t need to worry about the DetectDevice.h code. That is just used to send info about the board to display in the Cayenne dashboard. It doesn’t affect library functionality.