Hi,
I am trying to get the modem BG96 of RAK8212-M working with mbed os 5.15. I know it is mbed library, but maybe you could tell me what is the right sequence of initiation of pins and the timing. The modem BG96 does not respond to anything. I have two devices, I tried same programs on both.
I have peeked into old RAK firmware (not based on RUI, RAK8212-itracker-firmware-based-on-nRF5SDK15.0.0-with-DFU), and used the same sequence and still it does not work. The RUI based is not open sourced.
#define GSM_PWR_ON_PIN 6
#define GSM_RESET_PIN 14
#define GSM_PWRKEY_PIN 15
#define GSM_TXD_PIN 9
#define GSM_RXD_PIN 7
#define GSM_PWR_ON nrf_gpio_pin_write ( GSM_PWR_ON_PIN, 1 )
#define GSM_PWR_OFF nrf_gpio_pin_write ( GSM_PWR_ON_PIN, 0 )
#define GSM_PWRKEY_HIGH nrf_gpio_pin_write ( GSM_PWRKEY_PIN, 0 )
#define GSM_PWRKEY_LOW nrf_gpio_pin_write ( GSM_PWRKEY_PIN, 1 )
#define GSM_RESET_HIGH nrf_gpio_pin_write ( GSM_RESET_PIN, 0 )
#define GSM_RESET_LOW nrf_gpio_pin_write ( GSM_RESET_PIN, 1 )
void Gsm_PowerUp(void)
{
GSM_PWR_OFF;
delay_ms(200);
/*Pwr stable wait at least 30ms before pulling down PWRKEY pin*/
GSM_PWR_ON;
GSM_RESET_HIGH;
delay_ms(60); // >30ms
/*Pwr key keep to low at least 100ms*/
GSM_PWRKEY_LOW;
delay_ms(300); //300ms
GSM_PWRKEY_HIGH;
delay_ms(500);
}
I am looking at the schematics downloads_rakwireless_com/en/Cellular/RAK8212/Hardware-Specification/RAK8212_iTRACKER_Schematic_20180322.pdf
So I defined my pins:
MDMTXD = p9,
MDMRXD = p7,
MDMRTS = p10,
MDMCTS = p8,
// MDMSTAT = NC, - ?? - this on the schematics is not marked with red x - is it connected?, STATUS
// MDMDTR = NC, - not connected
M_POWR = p6,
PWRKEY = p15,
RESET_MODULE = p14,
The functions to initialize I use:
void RAK_QUECTEL_BG96::onboard_modem_init()
{
gpio_t gpio;
// Power Supply
gpio_init_out_ex(&gpio, M_POWR, 0);
// Turn On/Off
gpio_init_out_ex(&gpio, RESET_MODULE, 0);
gpio_init_out_ex(&gpio, PWRKEY, 0);
thread_sleep_for(WAIT_AFTER_POWR_CHANGED);
}
then power up is called
void RAK_QUECTEL_BG96::onboard_modem_power_up()
{
gpio_t gpio;
// Power supply ON
gpio_init_out_ex(&gpio, M_POWR, 1);
thread_sleep_for(1000);
thread_sleep_for(100);
press_power_button(200);
}
and finally
void RAK_QUECTEL_BG96::press_power_button(int time_ms)
{
gpio_t gpio;
gpio_init_out_ex(&gpio, PWRKEY, 1);
thread_sleep_for(time_ms);
gpio_write(&gpio, 0);
}
The error I get is always the same -3012 - which means modem not responding.
[DBG ][CELL]: AT flush
[INFO][CELL]: AT TX ( 2): AT
[INFO][CELL]: AT TX ( 1):
[DBG ][CELL]: AT error -3012
[INFO][CELL]: Power on modem
[DBG ][CELL]: AT error -3012
[WARN][CELL]: AT timeout
[DBG ][CELL]: AT error -3012
[DBG ][CELL]: consume_to_tag not found
[DBG ][CELL]: AT stop tag not found[DBG ]
[CELL]: AT error -3012[DBG ]
[CELL]: AT flush[INFO][CELL]: AT TX ( 2): AT
[INFO][CELL]: AT TX ( 1): [DBG ][CELL]: AT error -3012[WARN][CELL]: Reset modem[DBG ][CELL]: AT error -3012[WARN][CELL]: AT timeout[DBG ][CELL]: AT error -3012[DBG ][CELL]: consume_to_tag not found[DBG ][CELL]: AT stop tag not found[DBG ][CELL]: AT error -3012[ERR ][CELL]: Modem not responding[DBG ]
I initialize serial by
static UARTSerial serial(MDMTXD, MDMRXD, 115200);
serial.set_flow_control(mbed::SerialBase::RTSCTS, MDMRTS, MDMCTS);
static RAK_QUECTEL_BG96 device(&serial, M_POWR, active_high = true, RESET_MODULE);
- Is there any order I am doing wrong?
- Should I use some pull ups?
- Should I use active high / active low for RESET or POWERKEY?
I think I tried everything I mentioned except pullups. I tried with and witout flow control. It just does not respond. At some point I got the modem to respond but after I restarted device it still does not respond.
For more reference: this is my
mbed_app.json mbed_app.json · GitHub
custom_targets.json custom_targets.json · GitHub
Modem works with RUI hex and responds.