This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

GATT ERROR - Advertising problem

Hi!

Im using SDK14.2 and I m working with the custom characteristics tutorial(the one compatible with the SDK 14.2).I have an SDK5 device connected to a LORA radio with pins.

You can find my codes here : https://github.com/amocsrotkiv/Forest-Sensor/tree/LORA_TX

The problem is with the following function in main() :

sx127x_init(LORA_SPI_MOSI,
                LORA_SPI_MISO,
                LORA_SPI_CLK,xac yxc
                LORA_SPI_SELECT,
                LORA_RESET,NULL);

If I uncomment theese lines everything works fine(I see LED 1 blinking occasionally: indicating advertisment). But when I leave it in the code I rarely even see the device in the NRF connect app (usually only exactly after I have built it in SES) and even when I see it and try to connect I get the following error: 133 (0x85) GATT ERROR. I see LED1 is constantly on.

I debugged it in SES and I can see this error message: ERROR 8 [NRF_ERROR_INVALID_STATE] at C:\nRF5_SDK_14.2.0_17b948a\examples\ble_peripheral\master-viktor_tx\sx127x_drv.c:841

EDIT1: By commenting this line /*err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, bsp_event_handler);*/  in: buttons_leds_init(bool * p_erase_bonds) and moving the sx127x_init() function before the BLE initialization I could solve the previous problem.(well LEDS are not working now but at least I can see the device advertising)
{

EDIT2: I have 2 exactly similiar devices(2 Nordic devkit pca10040 and 2 sx127 Lora radio) and the problem is that my code only works with one of them. The problem is the same as I cant see one of them adverstising after I built the code. I tried to debug as much as I could and I got the following errors:

It is in this function:

Do you have any idea what can cause this?

Thanks a lot,

Viktor

Related