Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 1 month ago.
Problems initializing Zigbee S2C with STM board.
Hi Everyone,
I'm running into some problems with initializing a Digi XBee S2C with a NucleoF103RB board.
Currently I'm using the XBeeLib_Fixed from Lorenzo Maiorfi, though I've used Digi's official library as well.
I have my XBee connected to UART 2 (D0/D1) with the reset connected into D2.
Pinout to the F103 Board: https://os.mbed.com/platforms/ST-Nucleo-F103RB/
When I try to initialize Zigbee, it returns a fail and I can't for the life of me get it past the XBeeZB.init(); step.
I've configured my Zigbee through XCTU with API mode set to [1] as a coordinator, SM is set to [0]; It's currently flashed with function set "ZigBee TH Reg" on firmware version 4060.
Here is my code:
main.cpp
#include "mbed.h" #include "XBeeLib.h" using namespace XBeeLib; Serial PC(USBTX, USBRX); int main() { XBeeZB xbee = XBeeZB(PA_2, PA_3); RadioStatus const init = xbee.init(); if(init != Success){ PC.printf("Zigbee could not be initialized properly, check pins!\r\n\r\n"); } else PC.printf("Zigbee Successfully Initialized\r\n\r\n"); wait(1); RadioStatus const reset = xbee.hardware_reset(); if(reset != Success){ PC.printf("Device was not successfully reset, check your reset pin\r\n\r\n"); } else PC.printf("Successfully Reset XBee Device"); }
and the important parts of the config.h file
config.h
#define RADIO_TX D1 #define RADIO_RX D0 #define RADIO_RESET D2 #define DEBUG_TX USBTX #define DEBUG_RX USBRX
EDIT: I realize that my code has a const condition for RadioStatus, however it does not initialize even if I remove the const before init and reset.
Pins:
Zigbee -->F103RB
Pin 1 (VCC)-> 3.3v
Pin2 (TX)-> D0 (RX)
Pin3(RX)-> D1(TX)
Pin5(RST)-> D2(GPIO)
Pin 10(GND)-> GND
If I'm missing any information, please feel free to mention it.
Thanks all!