MKW30 GAP Dual Role Applications KW40Z_Connectivity_Software_1.0.1

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MKW30 GAP Dual Role Applications KW40Z_Connectivity_Software_1.0.1

ソリューションへジャンプ
3,412件の閲覧回数
lucianfiran
Contributor V

I have a BLE project based on MKW30Z and KW40Z_Connectivity_Software_1.0.1

What is the best start-up demo project for the following application:
- OTAP Client for sw update
- Led RGB+White lamp control (server like)

5.2 Peripheral Demo Applications
5.3 Central Demo Applications
5.4 GAP Dual Role Demo Applications
5.5 Over The Air Programming (OTAP) -> OTAP Client

Bluetooth® Low Energy (BLE) Demo Applications User’s Guide
BLEDAUG Rev. 1, 10/2015

My guess is to start with GAP Dual Role - add Lamp custom profile +
OTAP profile and remove what is not needed.

But is it possible to connect like a Peripheral,
than start OTAP client from there if needed ?

Thank you.

タグ(4)
1 解決策
2,494件の閲覧回数
santiago_lopez
NXP Employee
NXP Employee

Hi Lucian,

 

I downloaded the code from your repository and was able to compile but J-Link launched errors at the moment of downloading the code (maybe problems with the flashloader). Anyway I created an example code for you to test your hardware and discard it as the issue. This code implements OTAP client + LED Controller. It uses the Kinetis BLE Toolbox smartphone application for testing. I tested this application on the FRDM-KW40Z and our KW30 Beacon reference design so it must work on your side if there are not issues with the custom hardware.

 

Steps to configure this application for your board

  1. Open app_preinclude.h and indicate the number of LEDs and Buttons in your board
  2. pastedImage_1.png
  3. Open gpio_pins.h and create enums for all your LEDs and Buttons on the board. Route them to the proper GPIO port and pin.

pastedImage_3.png

3.Open gpio_pins.c and complete the initialization structure for all your LEDs and Buttons

pastedImage_4.png

4. Compile and download your application to the KW30

5. On your smartphone download the latest version of Kinetis BLE Toolbox

6. Press the push button you defined as SW1. Application must start advertising

7. Open Kinetis BLE Toolbox in your smartphone and tap on the FRDM-KW40Z Demo application

pastedImage_5.png

8. Wait for the devices to show. Tap on the device named OTAP_LED. Device must connect.

pastedImage_6.png

9. Tap on the LED application

pastedImage_7.png

10. Move the LED switches. You should see the LEDs on your board turn on and off accordingly

pastedImage_8.png

If everything is ok with the hardware, you can use this application as a basepoint for your development.

 

Let me know how it went.

元の投稿で解決策を見る

18 返答(返信)
2,495件の閲覧回数
santiago_lopez
NXP Employee
NXP Employee

Hi Lucian,

 

I downloaded the code from your repository and was able to compile but J-Link launched errors at the moment of downloading the code (maybe problems with the flashloader). Anyway I created an example code for you to test your hardware and discard it as the issue. This code implements OTAP client + LED Controller. It uses the Kinetis BLE Toolbox smartphone application for testing. I tested this application on the FRDM-KW40Z and our KW30 Beacon reference design so it must work on your side if there are not issues with the custom hardware.

 

Steps to configure this application for your board

  1. Open app_preinclude.h and indicate the number of LEDs and Buttons in your board
  2. pastedImage_1.png
  3. Open gpio_pins.h and create enums for all your LEDs and Buttons on the board. Route them to the proper GPIO port and pin.

pastedImage_3.png

3.Open gpio_pins.c and complete the initialization structure for all your LEDs and Buttons

pastedImage_4.png

4. Compile and download your application to the KW30

5. On your smartphone download the latest version of Kinetis BLE Toolbox

6. Press the push button you defined as SW1. Application must start advertising

7. Open Kinetis BLE Toolbox in your smartphone and tap on the FRDM-KW40Z Demo application

pastedImage_5.png

8. Wait for the devices to show. Tap on the device named OTAP_LED. Device must connect.

pastedImage_6.png

9. Tap on the LED application

pastedImage_7.png

10. Move the LED switches. You should see the LEDs on your board turn on and off accordingly

pastedImage_8.png

If everything is ok with the hardware, you can use this application as a basepoint for your development.

 

Let me know how it went.

2,494件の閲覧回数
lucianfiran
Contributor V

How can I get your example, can you please provide a link ?

About Jlink warnings - I disabled NMI interrupts from flash config (FF -> FB) in startup_MKW30Z4.s:

SECTION FlashConfig:CODE
__FlashConfig
DCD 0xFFFFFFFF
DCD 0xFFFFFFFF
DCD 0xFFFFFFFF
DCD 0xFFFFFBFE
__FlashConfig_End

 I unchecked Project Options -> Debugger -> Download -> Use flash loader(s)

Thank you.

Best Regards,

Lucian

0 件の賞賛
返信
2,494件の閲覧回数
santiago_lopez
NXP Employee
NXP Employee

The code is attached at the bottom of my previous comment.

pastedImage_1.png

I will copy your flashloader configuration and try to run your code again for debugging.

Saludos

0 件の賞賛
返信
2,494件の閲覧回数
lucianfiran
Contributor V

Hello,

I debug mode everything is OK.

I tried to build the app for Release

Project -> Edit Configurations -> Release

and got some linker issues:

if I enable Automatic run time library selection

Error[Li005]: no definition for "__VECTOR_RAM" [referenced from fsl_interrupt_manager.o(libksdk_platform.a)]
Error[Li005]: no definition for "NV_STORAGE_END_ADDRESS" [referenced from D:\Work\2016\Beacon\LampsterV1\release\obj\ApplMain.o]
Error[Li005]: no definition for "__VECTOR_TABLE" [referenced from D:\Work\2016\Beacon\LampsterV1\release\obj\startup.o]
Error[Li005]: no definition for "__RAM_VECTOR_TABLE_SIZE" [referenced from D:\Work\2016\Beacon\LampsterV1\release\obj\startup.o]

otherwise without automatic:

Error[Li005]: no definition for "__iar_program_start" [program entry]

setting this:

C:\Freescale\KW40Z_Connectivity_Software_1.0.1\ConnSw\bluetooth\host\lib\ble_host_peripheral_lib.a
C:\Freescale\KW40Z_Connectivity_Software_1.0.1\KSDK_1.3.0\lib\ksdk_platform_lib\iar\KW40Z4\release\libksdk_platform.a
C:\Freescale\KW40Z_Connectivity_Software_1.0.1\ConnSw\framework\SecLib\lib_crypto_IAR_M0.a
C:\Freescale\KW40Z_Connectivity_Software_1.0.1\ConnSw\bluetooth\controller\lib\ble_controller_lib.a

I Added Configuration file symbol definitions:

gUseNVMLink_d=1
__ram_vector_table__=1

Some suggestions ?

Best Regards,

Lucian.

0 件の賞賛
返信
2,494件の閲覧回数
santiago_lopez
NXP Employee
NXP Employee

Hi Lucian,

I forgot to update the configuration for the release project with the changes made. Please do the following.

  1. Return to the debug configuration
    pastedImage_1.png
  2. Right click in the project and select options
    pastedImage_2.png
  3. Go to C/C++ Compiler and select the Preprocessor tab. Select and copy all the content of the "Additional directories" box.
    pastedImage_3.png
  4. Close the window and return to the Release configuration.
    pastedImage_4.png
  5. Go again to the preprocessor tab in C/C++ Compiler. Select all the content of the Additional Directories box and replace it with the lines you previously copied from Debug.
  6. Go to the Linker section. In the Override default box, in the icf file name replace MKW40Z with MKW30Z
    pastedImage_5.png
  7. Recomplile. This time you shouldn´t find errors.

Saludos

Santiago

2,494件の閲覧回数
lucianfiran
Contributor V

Hi Santiago,

I added Linker/Input (Keep symbols, Raw binary image ...) like:

Create a binary file for OTAP 

Debug builds ok

pastedImage_1.png

pastedImage_2.png

pastedImage_6.png

and Release builds ok :

pastedImage_3.png

pastedImage_4.png

pastedImage_5.png

but the program does not run correctly, it advertise but no connection to phone.

Lucian.

0 件の賞賛
返信
2,494件の閲覧回数
lucianfiran
Contributor V

The issue seems to be the config file symbols:

gUseBootloaderLink_d=1
gUseInternalStorageLink_d=0

2,494件の閲覧回数
lucianfiran
Contributor V

I cannot see the download attachement, tried Firefox 50.0 and IE

----------------

pastedImage_1.png

-------------

0 件の賞賛
返信
2,494件の閲覧回数
santiago_lopez
NXP Employee
NXP Employee

Is because you are in the Inbox preview. Try to enter to the actual post https://community.nxp.com/thread/438906 

2,494件の閲覧回数
lucianfiran
Contributor V

It seems to work ok !

Not tested OTAP download. Do you have an example file to use for OTAP ?

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

0 件の賞賛
返信
2,494件の閲覧回数
lucianfiran
Contributor V

Tried with other sw on Samsung tab:

Bluetooth LE Scanner - Android Apps on Google Play 

Adv ok but no connection:

pastedImage_2.png

BTN not trigerrs, led not blink.

0 件の賞賛
返信
2,494件の閲覧回数
lucianfiran
Contributor V

if I add at the end of:

static void BleApp_Config()
{  

    BleApp_Start();
}

The board start advertising but not connect.

Led full off not blinking, BTN not working.

pastedImage_2.png

pastedImage_3.png

nRFConnect log: Device disconnected Error 133 (0x85) GATT ERROR

If I power off lamp, the board is dead, no leds, no BTN, no adv.

0 件の賞賛
返信
2,494件の閲覧回数
lucianfiran
Contributor V

On github:

The leds will not flash and the button does not trigger.

Possible config issue (Clocks, Timers issues ) ?

pastedImage_1.png

PCB:

 has 3.3 voltage regulator;

 5 led channels N mos on (with 100R series resistor and 10K pull dn on) RGB channels PTB18, PTC0, PTC1,

    and 2 x white  PTA0, PTA1 used for SWD now.

1 PTC3 input with series resistor 47R, 1Meg pull-up.

NMI disabled from startup_MKW30Z4.s

        SECTION FlashConfig:CODE
__FlashConfig
          DCD    0xFFFFFFFF
          DCD    0xFFFFFFFF
          DCD    0xFFFFFFFF
          DCD    0xFFFFFBFE
__FlashConfig_End

SPI flash AT45DB021E-SSHN-T

SO - PTC18; SI - PTC17; SCK - PTC16; CS - PTC19

BALUN MURATA-LDB212G4005C-001

Quatz 32MHz NXS3225SA-EXS00A-CS0236 + 2 x 13pF

RTC quartz + 12pF

0 件の賞賛
返信
2,494件の閲覧回数
lucianfiran
Contributor V

Hola,

I put the code here GitHub - firanl/BLE_Lamp: MKW30Z BLE based lamp 

I will go on bitbucket on a private repo as is stable.

Best Regards,

Lucian.

0 件の賞賛
返信
2,494件の閲覧回数
lucianfiran
Contributor V

Yes custom hardware (how can I attach a schematic pdf ?).

PC SW IAR 7.50

bare_metal FSL default RTOS

Phone testing with:
Samsung Galaxy Tab A SM-T555 Android 6.0.1
SW: nRF Connect, Kinetis BLE Toolbox

iPhone 5C ME544LL/a iOS 10.1.1
SW: nRF Connect, custom software under development for this project.

I guess the set-up is the main issue here as it has many configuration files not so well documented:
board.c, board.h, app_config.h, app_preinclude.h, app.h
....
There is a list of switches for this files,
 I see a lot of variation across projects (documentation) ?

I tried some demo project porting from MKW40Z to MKW30Z.
 I once succeeded in communicating once based on
bluetooth_temperature_sensor, but I flush the code from mistake (attached pics).

pastedImage_1.png

pastedImage_2.png

Best Regards,

Lucian

0 件の賞賛
返信
2,494件の閲覧回数
santiago_lopez
NXP Employee
NXP Employee

Are you using custom hardware? Or you bought some third party hardware? Our first recommendation is to run the demos in FRDM-KW40Z or USB-KW40Z so we know the software is configured for the hardware being used (XTALS, GPIOS, …).

 

Also, some of our BLE demos have had problems connecting with a few smartphones running Android 7.0 (Nougat), specially Nexus 5X. You could try to connect with another smartphone (an iPhone for example) just to make sure this is not a smartphone problem.

 

Finally, you mentioned that the connection break-point is not being reached. You can check if the software is not getting stuck in some task or hard faulting due some software issue like creating a task that has a bigger priority than the Host_Task or the L2CA_Task. If any of those get blocked, BLE will not work properly.

 

That’s all it comes to my mind right now. We would need to debug your particular software to find what can be preventing the application from connecting.

 

Saludos

 

Santiago Lopez – Systems Engineer

2,494件の閲覧回数
lucianfiran
Contributor V

Hola Santiago,

Yes you are right.

I understand now that the 'Client' from OTAP si referring to the otap app 'protocol' itself.

Device
LayerLampSmart phone
GAPPeripheralCentral
GATTServerClient
OTAPClientServer

I tried to use some cloned examples to start with like: bluetooth_blood_pressure_sensor  bluetooth_glucose_sensor  bluetooth_temperature_sensor also bluetooth_otap_client_att

but most of them advertise correctly on Kinetis BLE Toolbox, but they do not connect.

(no data on Android, didn't hit the connection break-point )

PCB with MKW30Z, DCDC bypass mode, 5 TPM led outpus, 1 gpio(tsi) input button, spi flash.

Any suggestion on this ?

Best Regards,

Lucian.

0 件の賞賛
返信
2,494件の閲覧回数
santiago_lopez
NXP Employee
NXP Employee

Hi Lucian,

 

Your final application would be something like a BLE controlled lamp that can be firmware updated using OTAP, am I right?

 

If this is the case, you will not need a Dual-Role application. See, the OTAP Client that receives the update actually is a GAP Peripheral. It includes the OTAP service and advertises it. It is then accessed by the OTAP Server (which is actually a GAP Central) that communicates with a PC to gather the binary file to be loaded to the OTAP Client.

 

My suggestion for you is to use the OTAP Client demo as basepoint. Then you can add on the top of it a custom service for the Lamp control. We have a demo application that includes several custom services and a LED control among them. You can find it in the following links.

 

Documentation: http://www.nxp.com/files/32bit/doc/user_guide/FRDMKW40ZDAUG.pdf?fasp=1&WT_TYPE=Application%20Notes&W... 

Firmware: http://cache.nxp.com/files/32bit/doc/user_guide/FRDMKW40ZDAUGSW.zip 

 

Hope this information is useful for you.

 

Saludos

 

Santiago Lopez – Systems Engineer