BLE communication error when declaring real data type

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

BLE communication error when declaring real data type

270 Views
SeokJin
Contributor II

Hello,

I'm studying the "Low Power Temperature Sensor and Collector" example from the KW36 SDK.

In this example, the Sensor (Server device) collects temperature and transmits it to the Collector (Client device).

In the process of outputting the temperature value received from the collector device, I would like to output the temperature value, which is previously output in integer form, in real number form.

->(For example, I would like to output "24.xx degrees Celsius" rather than "24 degrees Celsius".)

 

However, when a real data type variable (for example, float) is declared to output 24.xx degrees Celsius, a connection error occurs in BLE communication.

SeokJin_0-1711803193291.png

Currently, I have declared a float variable called "float_t r" in the BLE_temp_collector.c example.

 

However, even though I only declared a floating-point variable, after building and debugging, when I check the value output from Putty, it says that pairing was not successful as shown below.

SeokJin_1-1711803880439.png

Why does this result occur?
Can't I use real variables in this example? Or is my declarative float data type (float_t) wrong? If not, do I need to add a specific header file?

 

I don't know what's the problem that prevents pairing. Please tell me how I can solve it.

Thanks in advance.

 

Regards,

SeokJin.

0 Kudos
2 Replies

220 Views
Ricardo_Zamora
NXP TechSupport
NXP TechSupport

Hello,

 

Hope you are doing well. Could you please clarify if you made any ither modification to the example?

 

Also, what SDK version are you using?

 

Regards,

Ricardo

0 Kudos

204 Views
SeokJin
Contributor II

Hello, @Ricardo_Zamora

Although the example has been modified, the overall framework is the same.

I simply declared a float data type variable to output the temperature, which had been declared and output as uint16_t, in real number format.

If you look at the picture I attached before, it means float_t r.

I currently have it commented out, but after uncommenting it and debugging, an error occurs in the pairing part when I try to communicate with BLE.

The SDK I am using is "SDK_2_2_12_FRDM-KW36", and MCUXpresso is using "MCUXpresso IDE v11.8.1_1197".

 

In addition to the questions I asked previously, I have an additional question.

 

SeokJin_0-1712200977659.pngWhen I change the Library to "NewlibrNano (nohost)" in the "Properties" of BLE temperature_collector, "Enable print float" is activated and it looks like I can check it and apply it. Is it okay to change the library?

The existing library was "Redlib (nohost-nf)".

 

Regards,

SeokJin.

0 Kudos