1

my new Nano 33 BLE Sense arrived today. I'm working on a project to send data from the the Nano via an Xbee S2C module to a receiver module connected to a Nano 33 IoT. I had the project working before using an MPU6050 and Mega 2560 board which worked (using Software Serial on the Mega). On the IoT side, I am using 'Uart XBeeRx (&sercom0, 5, 6, SERCOM_RX_PAD_1, UART_TX_PAD_0);' to process the data from the Xbee. Having tried this syntax on the BLE Sense I hit problems and after some Googling found a different syntax. However my new code isn't working in so far as it compiles, uploads and then crashes the BLE Sense (serial port disappears from tools and the onboard LED blinks slowly and erratically). I need to keep resetting the board and suspect there is some issue with my hardware serial implementation. I've cut the code down to simply send accelerometer data. My code is as follows - the EasyTransfer library simplifies the Xbee comms. Any help appreciated!

#include <EasyTransfer.h>
#include <Arduino_LSM9DS1.h> 

 
UART XBeeTx (digitalPinToPinName(6), digitalPinToPinName(5), NC, NC);


EasyTransfer ET;

struct SEND_DATA_STRUCTURE {

  float xAcc;
  float yAcc;
  float zAcc;
    
};

SEND_DATA_STRUCTURE myData;



// ================================================================
// ===                      INITIAL SETUP                       ===
// ================================================================

void setup() {

XBeeTx.begin(9600);

ET.begin(details(myData), &XBeeTx);      
  
}


// ================================================================
// ===                    MAIN PROGRAM LOOP                     ===
// ================================================================

void loop() {

  float x, y, z;

if (IMU.accelerationAvailable()) {
    IMU.readAcceleration(x, y, z);
    
  }

  myData.xAcc = x;
  myData.yAcc = y;
  myData.zAcc = z;

  
  ET.sendData();
  
}
5
  • why not use Serial1? (on Mega too)
    – Juraj
    Commented Apr 20, 2021 at 19:53
  • Hi, I tried that connecting my Xbee out and in pins to D0 and D1 (UART Rx and Tx) but the same problem and using Serial1.begin(9600) and &Serial1 in the ET.begin statement in the code above. The Nano Sense seems to lose its USB connection and locks up. Really can't work out why as it should work. I think the board is OK as I can run some of the example scripts just fine (e.g. accelerometer and print to the USB serial). Google seems really light on hits for UART Hardware Serial in the BLE Sense!
    – RobM
    Commented Apr 20, 2021 at 22:08
  • The two boards are use different Arduino cores. The IoT 33 uses a chip family common to Arduino boards; the Nordic Semi ARM chip that's in the BLE Sense is much less so. The ARM chips used in these devices are only so related. The "SERCOM_RX_PAD_1" naming is connected to Atmel (and the 33 IoT); using it as a search term in finding a solution to doing this on your BLE Sense maybe counterproductive.
    – timemage
    Commented Apr 21, 2021 at 2:00
  • 1
    Doh! I'm a muppet!! I'm making a call to IMU without having put IMU.begin() in setup. I'd deleted it along with some other code that was redundant but added it back in and the project works like a dream! BLE Sense unit works properly and receiver unit getting the data over the Xbee comms now. Thanks for the comments though.
    – RobM
    Commented Apr 21, 2021 at 7:15
  • @RobM, if this is something that makes sense following from the question, in a way that might be useful to someone else, you can post an answer your own question. If the solution has nothing to do with the question asked, then probably the thing to do is just delete the question.
    – timemage
    Commented Apr 21, 2021 at 23:56

1 Answer 1

2

You can't make calls to IMU if you haven't initialised it with IMU.begin()

1
  • You should be able to mark your own answer as accepted.
    – timemage
    Commented Apr 26, 2021 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.