QN9080DK BLE beacon example not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

QN9080DK BLE beacon example not working

Jump to solution
3,826 Views
arpad_toth
Contributor II

Hello,

I tried to generate BLE examples with MCUXpresso v4.1, MCUexpresso_SDK 2.2.0, IAR 8.32.1

  wireless/beacon/baremetal
  wireless/beacon/freertos
  wireless/heartbeat/baremetal

Downloaded to QN9080DK devboard, pressed reset.
But the none of the BLE applications are showing up.
Tested with 2 different Android phones, they see other beacons but not the devkit. Also it doesnt work with the IOT NXP app.

I tried to remove the ISP jumper, USB unplug/reconnect then press reset, didn't help.

RGB LED seems to be white. Red LED flashes on debugger section.
Debugging works perfectly with non BLE app.

Debugging fails on BLE app:


     assembly starts on __iar_program_start, but after stepping:
     the CPU clock is stalled by the memory controller.
     CPU status FAILED
     Reset or power cycle the board.CoreSight error: Write error while enabling DAP debug access.
     Unable to execute: driver error. After the error occurred, the program counter (PC) was <unknown>.
     Cannot initialize DAP access.

What to do next?

Tags (2)
0 Kudos
Reply
1 Solution
3,214 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Which power down are you using? Sorry it is not clear for me what are you trying to do and where are you changing the settings in the code. Also, as this is a different matter, it will be easier to address it in a different post to have all the information with more control and order as this it's related more to a low power issue. 

Regards ,

Estephania 

View solution in original post

0 Kudos
Reply
20 Replies
3,214 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Does it have CMSIS-DAP interface or J-Link interface?

Could you please confirm you have the board's drivers installed?  

In which OS are you working? 

If you flash the binary by using the QN9080 Programming Tool, does it works? 

Which guide are you following in your process? 

Regards, 

Estephania 

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

Hello,

It's the stock QN908x DK V1.2 board, USB connected to J2. CMSIS-DAP is the default.

"USB serial device" shows up in device manager, so it's correctly installed. Also debugging works perfectly with non BLE examples.

I also tried to program it with lpcscrypt + boot_lpcscrypt.cmd with the compiled binary. (see attached)

Same result, no BLE device is showing up.

Do you have a working binary for this board? Like BLE beacon.

0 Kudos
Reply
3,214 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Which it's the SDK tag of the one you use? 

I was able to run correctly in both IAR and MCUXpresso using the latest SDK available in the builder but the MCUXpresso you are using it's quite old, you should try using the MCUXpresso IDE v10.2.1. The MCUXPresso v10.3 does not support the wireless connectivity examples yet, but it will. 

I'm attaching the binary used for beacon.

I would also recommend you to use the QN9080 Flash programmer which you do not mention to use as another way to test that the binary it's being flashed correctly.

Regards, 

Estephania 

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

I'm trying your binary, BLE still doesnt show up, am I doing it right?

DFU jumper on  QN9080DK  v1.2 devboard 

C:\nxp\LPCScrypt_2.0.0_831\scripts\boot_lpcscrypt.cmd

Booting LPCScrypt target with "LPCScrypt_218.bin.hdr"
LPCScrypt target booted

lpcscrypt.exe targetinfo  (is this programming the debugger or QN9080?)

LPC4322: BankA 512KB PartID: 0xa00bcb3c 80 Clock: 180000000Hz
BankA: 0x1a000000-0x1a07ffff (512K bytes) PageSize: 0x1000
EEPROM: 0x20040000-0x20043f7f (16256 bytes) PageSize: 0x80
ID: 0x04027016 0xaab1f0e2 0x58446570 0xf50007c5

lpcscrypt.exe program beaconwireless_examples_bluetooth_beacon_freertos.bin BANKA

Programmed 176540 bytes to 0x1a000000 in 0.419s (411.404KB/sec)

lpcscrypt.exe verify beaconwireless_examples_bluetooth_beacon_freertos.bin BANKA

Verified 176540 bytes to 0x1a000000 in 0.064s (2693.913KB/sec)

I don't really want to install MCUXpresso IDE, because it's huge.

LPCScrypt was the only CLI utility I found for NXP.

0 Kudos
Reply
3,214 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

The board has an LPC and a QN9080, are you sure that you are loading the file correctly to the correct IC?  

Please check the QN908x Quick Start User Manual chapter 3. Download and install software. Please also check the BLE Demo Applications User's Guide available in the SDK. 

Regards, 

Estephania 

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

Thank you, it works after updating MCUXpresso.

Is there a more minimal example of BLE beacon, other than the one included in SDK? It is bloated with extra modules, like RTC, NV..

0 Kudos
Reply
3,214 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

No,  the only available examples are the ones in the SDK. 

Sorry for the inconvenience this might cause you. 

Regards, 
Estephania 

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

Hello,

Is it necessary to periodically restart the BLE host stack for reliable long term operation? If so with which API?

Or it has infinite internal retries, so if I issue a SCAN beacons command, do I need to make sure it is still SCANNing continuously? Or it never hurts to restart scanning/full stack from time to time?

What I don't want is to have the application running normally with BLE subsystem failed.

Thank you,

0 Kudos
Reply
3,214 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

I believe this post will help you: 

[KW41Z] Implementing Beacon Scanner   

By adding that it will scan work as some of the examples that after a timeout it will stop scanning and you will need to start over by pressing the button. I believe it might help you as a guide. 

And I'm not sure I understand the restarting question, could you please help me with a little more explanation ? Are you seeing that behavior? If you do, where? 

Regards, 

Estephania 

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

Hello,

We got the beacon transmission and reception working.

My question is the long term reliability of the BLE stack, does it need periodic restarts (to prevent getting stuck) like every month/year to make sure it works?

Or does it have its own internal house keeping, and try to recover if BLE periphery stopped working because of HW bug, or like external BLE jamming/flooding.

Imagine a BLE TV, where the BLE is not responding but the TV functionality still works, you would have to unplug the TV from AC to get BLE subsystem working again, unless the BLE host can recover itself without unplugging AC.

0 Kudos
Reply
3,214 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

it should be able to work without any issues but it will also depend on how reliable your application it's developed

Regards, 
Estephania 

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

Hello,

How can I only transmit one beacon packet and then stop advertising?

Gap_StartAdvertising()

// looking for callback after packet sent out, or poll?

Gap_StopAdvertising() 

Thank you,

0 Kudos
Reply
3,214 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

What do you mean with one packet ? If you only send one, there will be a strong possibility that the device scanning will miss the packet.

Do you want it for some specific time ?


Regards,

Estephania

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

Hello,

I would like to control the power profile, like

power-down mode for 1sec

send one BLE adv. packet (start adv. service)

power-down mode for 1sec  <- dont know when to start this part

send one BLE adv. packet

Setting the back off time to minimal will reduce the variance:

  minInterval = gGapAdvertisingIntervalRangeMinimum_c
  maxInterval = gGapAdvertisingIntervalRangeMinimum_c

0 Kudos
Reply
3,214 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

Again , if you only send one single packet, the chance for the scanning device to get it will be hard. What you are trying to do should be managed with the timer used to send the device to sleep and wake it up.

Regards,

Estephania

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

Hello,

What to do if BLE_get_sleep_mode() always returns kPmSleep for more than 4sec instead of kPmPowerDown0/1 after coming out from MCU powerDown0 mode?

It prevents me to issue another PowerDown0 mode. 

It's a TX only non connectable application, so it shouldn't wait for anything.

Did I miss something in my wake up code? (see above) Documentation is no use.

Issuing the following doesn't help:

BLE_prevent_sleep_on_wakeup() 

BLE_disable_sleep()

I've seen the same in the power profiling example, most of the time BLE comes out of MCU PD0 with "sleep" state (BLE_get_sleep_mode), thus it wont enter PD0 again only WFI because of that.

0 Kudos
Reply
3,215 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Which power down are you using? Sorry it is not clear for me what are you trying to do and where are you changing the settings in the code. Also, as this is a different matter, it will be easier to address it in a different post to have all the information with more control and order as this it's related more to a low power issue. 

Regards ,

Estephania 

0 Kudos
Reply
3,211 Views
arpad_toth
Contributor II

Opened a new one for it: https://community.nxp.com/message/1121783 

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

Hello,

I have a problem, the BLE is not giving gAdvertisingDataSetupComplete_c callback after waking up from power down 0. It works if I run it directly from IAR (doesn't really enter power down 0).

Process (based on BLE profiling example)

Gap_StopAdvertising()

Prepare to sleep() 

POWER_EnterPowerDown(0)

EXTI wakeup

Post sleep()

Gap_SetAdvertisingData(&gAppAdvertisingData, NULL) == gBleSuccess_c

(successfully getting here)

// not receiving gAdvertisingDataSetupComplete_c callback

========================================================

Post sleep(): (based on example):

_switch_to_XTAL(); /* required for PD0 */

SYSCON->CLK_EN = SYSCON_CLK_EN_CLK_CAL_EN_MASK | SYSCON_CLK_EN_CLK_BLE_EN_MASK; /* dont use it with BIT_SET! */
/* imr = 1 */
CALIB->VCO_MOD_CFG |= CALIB_VCO_MOD_CFG_IMR_MASK;
/* AA error */
BLEDP->DP_AA_ERROR_CTRL = 0x0000000EU;
POWER_RestoreIO(); /* after this DIO is user configurable */

/* BLE wake up */
//POWER_DisablePD(kPDRUNCFG_PD_BLE); // todo not used in example
/* Prevent BLE sleep */
BLE_disable_sleep();
APP_RestoreBleReg();
/* BLE wakeup is onging */
NVIC_DisableIRQ(OSC_IRQn);
if(NVIC_GetPendingIRQ(OSC_IRQn))
{
NVIC_ClearPendingIRQ(OSC_IRQn);
BLE_prevent_sleep_on_wakeup();
}
/* Check if BLE is in sleep mode */
while(SYSCON->SYS_STAT & SYSCON_SYS_STAT_CLK_STATUS_MASK)
{
/* request BLE soft wakeup */
BLE_disable_sleep();
ble_soft_wakeup_req_setf(1);
/* wait until BLE LL is up and running */
while(!(SYSCON->SYS_STAT & SYSCON_SYS_STAT_OSC_EN_MASK))
{
}
}

/* check if not in sleep */
ASSERT(BLE_get_sleep_mode() < kPmPowerDown0);

(successfully finishing)

Is there any status I could read out from BLE? 

BLE seems to be fully powered and clocked.

0 Kudos
Reply
3,214 Views
arpad_toth
Contributor II

fixed, the problem was that the EXT interrupt never exit.

0 Kudos
Reply