11 years, 3 months ago.

Problem with mbed programm

Hi,

I want to write an mbed program that uses the XBee classes. Just to get startes I used

#include "mbed.h"
#include "m3pi.h"
#include "XBee.h"

m3pi m3pi(p23,p9,p10);
XBee xbee(p28,p27);

int main() {

    m3pi.locate(0,1);
    m3pi.printf("ne");
    wait(10000);
}

Without creating the XBee object the programm runs well and "ne" is displayed. As soon as I create the XBee object the programm is compiled without errors but not executed on the mbed. What could be the problem?

Question relating to:

1 Answer

11 years, 3 months ago.

Hi, checking the xbee code revisions from the user hiroshi yamaguchi, you can see that in the previous code of the Receive.cpp (the file that presents the error) in the Xbee library, there is a change in the first lines:

Before:

#define disableIRQ()          NVIC_DisableIRQ(UARTx_IRQn[_serial.index])
#define enableIRQ()        NVIC_EnableIRQ(UARTx_IRQn[_serial.index])

Now:

#define disableIRQ()          NVIC_DisableIRQ(UARTx_IRQn[_uidx])
#define enableIRQ()        NVIC_EnableIRQ(UARTx_IRQn[_uidx])

I change the _uidx with _serial.index and the program compiles without errors. I dont have a XBee right now to test if its funcionality is right with this change.

Greetings