Why the QN908XCDK demo wireless example does not have main.c?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Why the QN908XCDK demo wireless example does not have main.c?

7,560 次查看
albert_zhou
Contributor III

Hi, I just started QN9080SDK learning with an example for wireless bluetooth. I setup IoT Toolbox in my iPhone and tested the Proximity function with QN9080DK board. The communication seems work fine- the green LED blinking slow or quick as I tapped "Middle" or High" icon under Immediate Alert. the RSSI shown the dBm and Status is connected. 

I imported two example "qn908xcdk_wireless_examples_bluetooth_wireless_uart_freertos" and "qn908xcdk_wireless_examples_bluetooth_blood_pressure_sensor_freertos". But there is no main routine, so I don't known how to test the project,  although there is no error when I built the project.

I need help to have a simple main function to shown how to send a string like "hello world" to the BLE USB dongle shown on the PC screen.

 

0 项奖励
回复
6 回复数

7,319 次查看
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

The Bluetooth LE stack we provide use an RTOS, so you will find the int main in the fsl_os_abstraction_free_rtos.c, but there you will only find the scheduler initialization. In the ApplMain.c you will find the main_task, there are most of the initializations. 

If you want to communicate the wireless uart example with the blood pressure profile, you will need to do some code modifications 

I will strongly recommend you to check the BLE Demo Applications User's Guide to know how to run the project examples. 

 You can check in the BLE Application Developer's Guide the basic structure of the connectivity framework and a little explanation of the RTOS usage in the examples. 

Regards, 

Estephania 

0 项奖励
回复

7,312 次查看
albert_zhou
Contributor III

Hi Estephania,

Thank you for your advice. I have read that guides. That are not help much.

Albert Zhou

Sr. Electronics Engineer

Sensorex

p:

+1 714-230-2768

a:

11751 Markon Drive, Garden Grove, CA 92841

w:

www.sensorex.com<http://www.sensorex.com/>; e: albert.zhou@sensorex.com<mailto:albert.zhou@sensorex.com>

<https://www.facebook.com/Sensorex> <https://twitter.com/SensorexInc> <https://www.linkedin.com/company-beta/1768298/>

0 项奖励
回复

7,312 次查看
albert_zhou
Contributor III

I compile the demo example"qn908xcdk_wireless_examples_bluetooth_heart_rate_sensor_freertos" and launch the debug. the start cursor light up to int main() in fsl_os_abstraction_free_rtos.c. I use IoT Toolbox. there is no connection and won't work. So I guess all the demo examples for Bluetooth app don't work because it does not have a main() in source group.

0 项奖励
回复

7,312 次查看
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

By any chances does the debugger disconnects after flashing the board? If that it's the case, have you tried pressing the button 1 mentioned in the BLE Demo Applications User's Guide? The demo starts and goes to a low consumption mode, it does not start the advertisement automatically. 

I believe you might have missed that step I mentioned, please check the chapter  5.1 Heart rate sensor to see how to run the example. 

Regarding the main topic, I will recommend you and try to encourage you to read a little more regarding on how does the RTOS and the embedded systems work.

In case you are having an issue with the development kit and deploying the firmware and you are really following the steps in the guide I mentioned, I can try to help you, but I will need more details but please consider that the fact that the main it's not in the source group it's not the problem.  

Regards, 

Estephania 

0 项奖励
回复

7,312 次查看
albert_zhou
Contributor III

Estephania,

I did press button1. it could not get connected. after that, the MCUXpresso cannot launch debug anymore. It seems lost wire connection.

I have did a project with NXP KL27Z64VFM4 chip. I did not use all the drivers and libs. I started a demo and gradually change the code and learn to add the functions. I just simply use registers like I did many TI's MSP430 chips as below: I tested QN9080 with LEDs that seems works same way. But I don't know Why the QN9080-DK demos missed the main() intentionally. I don't know your "encourage you to read a little more regarding on how does the RTOS and the embedded systems work". has difference between KL27Z and QN908X except Bluetooth.

SIM->SCGC6 |=BIT27+BIT0;  

SIM->SOPT2 = ((SIM->SOPT2 & ~SIM_SOPT2_TPMSRC_MASK) | SIM_SOPT2_TPMSRC(1U)); //=1=48MHz

MCG->C2=0x0;

MCG->C1=0x43;

MCG->SC=0x00; //LIRC 2MHz/2  

PORTA->PCR[18] =BIT8; // pin 17=ALT1 PTA18= GPIO =A1(MAX4734_pin1)

PORTD->PCR[7] =BIT8; // pin 32 =ALT1 PTD7 = GPIO =RS485_Bus_Enable

// PORTC->PCR[3] |= BIT8+BIT10; //ALT=5 LPO =1K OUT

PORTB->PCR[1] =0; //ADC3 =SE9

PORTC->PCR[1] =0; //ADC4 =SE15 

LPUART0->CTRL =LPUART_RXIE_BIT+LPUART_TX_Enal_BIT+LPUART_RX_Enal_BIT;

NVIC_EnableIRQ(LPUART0_IRQn);  

LPUART0->BAUD =(LPUART0->BAUD & ~LPUART_BAUD_SBR_MASK)|(156u);

__disable_irq();

// Setup 1000ms system timer for signal process.

SysTick->LOAD = 1000000;//1 second24000-1; 

NVIC_EnableIRQ(LPUART0_IRQn);

TPM0->SC = TPM_SC_PS(1);//prescale =1 TPM0-SC=1 ,disable the counter

TPM0->CNT =50U;

TPM0->MOD =60000U; //Modulo, PWM=400Hz set PWM period 60K =400Hz

TPM0->CONTROLS[4].CnSC =BIT3+BIT5; //BIT3+BIT5=Edge Aligned duty cycle output; BIT2+BIT4 =50% toggle on match

TPM0->CONTROLS[4].CnV =500U; //duty 33%

TPM0->CONF =TPM_CONF_TRGSEL(0);

TPM0->SC |=BIT3; //Start timer

GPIOA->PDDR |=BIT4+BIT18+BIT19; //PTA4 =EN, PTA18=A1, PTA19=output=Gain

GPIOA->PDOR |=BIT19; //Set output=1

GPIOA->PSOR |=BIT19;

 

 

0 项奖励
回复

7,312 次查看
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

The example you mention it's in baremetal, it is not using an RTOS. 

Regards, 

Estephania 

0 项奖励
回复