Arduino mega and nbiot deluxe shield

hello
i’m starting to use the shield nbiot deluxe for work projects. I am currenty blocked because i cant upload any skecth to the board.
I am currently working on ardino mega + shield architecture. I figured that it has been designed to work with the arduino uno more than the mega ?
Is it still hackable ? i feel the pinout could cause problems being different with the uno ?
this is the utput i get after trying to upload. I think i have my ide setup good ?

i dont know if i have to choose a particular sodaq board in the board list ? i dont see nbiot deluxe shield in the list


thanks for your insights
im just starting on that sorry if my questions have already been answered but these questions are more for overall understanding of the system
thank you
David

Dear david,

It is possible to run the sketch on a Arduino Mega.
Only the Board what you selected isn’t a Arduino Mega but the Sodaq Explorer.
You need to make sure you got the right board selected (in your case the Arduino Mega).
It doesn’t matter you put a shield on it.

Kind Regards,
Paul

hi
thanks for the quick reply
thats what i thought too but i then got this error message


any idea ?
this is the code i try to upload. i believe it is the starting thing to do
#include “Arduino.h”

#if defined(ARDUINO_AVR_LEONARDO)
#define USB Serial
#define UBLOX Serial1

#elif defined(ARDUINO_SODAQ_EXPLORER)
#define USB SerialUSB
#define UBLOX Serial

#elif defined(ARDUINO_SAM_ZERO)
#define USB SerialUSB
#define UBLOX Serial1

#else
#error “Please select a Sodaq ExpLoRer, Arduino Leonardo or add your board.”
#endif

// Pin to turn on/off the nb-iot module
#define powerPin 7
unsigned long baud = 9600; //start at 9600 allow the USB port to change the Baudrate

void setup()
{
// Turn the nb-iot module on
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, HIGH);

// Start communication
USB.begin(baud);
UBLOX.begin(baud);
}

// Forward every message to the other serial
void loop()
{
while (USB.available())
{
uint8_t c = USB.read();
UBLOX.write©;
}

while (UBLOX.available())
{
USB.write(UBLOX.read());
}

// check if the USB virtual serial wants a new baud rate
if (USB.baud() != baud) {
baud = USB.baud();
UBLOX.begin(baud);
}
}

Dear david,

Yes, this error is correct.
This comes because you have this code:

if defined(ARDUINO_AVR_LEONARDO)
define USB Serial
define UBLOX Serial1
elif defined(ARDUINO_SODAQ_EXPLORER)
define USB SerialUSB
define UBLOX Serial
elif defined(ARDUINO_SAM_ZERO)
define USB SerialUSB
define UBLOX Serial1
else
error “Please select a Sodaq ExpLoRer, Arduino Leonardo or add your board.”
endif

You can remove all of this and just put this code in place:

define USB Serial
define UBLOX Serial1

The only thing i don’t know is what Serial port you can use on the Arduino MEGA.
I thought you could use SerialUSB and Serial or Serial1, i dont know that for sure.

Kind regards,
Paul

ok i got rid of the beginining and tried your code . from what i read here the mega has a bunch of serial :o is there one mandatory for the shield ?
i have this error now


again thanks

Hello david,

before i answer this question, what are you trying to do?
This code (nbIOT_serial_passthrough) makes it possible to talk and update the ublox modules.
In my code i deleted this section of code, because it is trying to find a baudrate what you have set in the code.

Kind regards,
Paul

right now all i want to do is upload a sketch to the arduino + shield

You have to connect the TX/RX to pin 18/19 on the mega.(don’t connect the tx/rx to tx0/rx0 on the mega)

remove:

#if defined(ARDUINO_AVR_UNO)
#include <SoftwareSerial.h> // Uno
#endif

#if defined(ARDUINO_AVR_LEONARDO)
#define DEBUG_STREAM Serial 
#define MODEM_STREAM Serial1

#elif defined(ARDUINO_AVR_UNO)
SoftwareSerial softSerial(10, 11); // RX, TX
// You can connect an uartsbee or other board (e.g. 2nd Uno) to connect the softserial.
#define DEBUG_STREAM softSerial 
#define MODEM_STREAM Serial

#elif defined(ARDUINO_SODAQ_EXPLORER)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial

#elif defined(ARDUINO_SAM_ZERO)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1

#else
#error "Please select one of the listed boards."
#endif

put in:


#define DEBUG_STREAM Serial 
#define MODEM_STREAM Serial1