cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Bluetooth

New Contributor

Hey coders,

Any one can give me the code for utilizing the motion sensor in the CYW20819EVB-02 evaluation kit.That would be very helpful.

0 Likes
Reply
1 Solution
Moderator
Moderator

Hi Nera_4289606

The project which I shared already have BLE part included.

Below are steps to test the project.   

1.      Connect the kit to your PC using the provided USB cable.

2.      Connect a wire between the motion sensor interrupt and BLE device GPIO P02 as per Table-1

Kits

Motion Sensor Interrupt

BLE Device Connection

CYW920819EVB-02

J17.1

D4

CYW920820EVB-02

J17.1

D4

CYW920719B2Q40EVB-01

TP1

D6

CYW920721B2Q40EVB-01

TP1

D6

3.      The USB Serial interface on the kit provides access to the two UART interfaces of the CYW208xx/CYW207xx device – WICED HCI UART, and WICED Peripheral UART (PUART). The HCI UART is used only for downloading the application code in this code example and the PUART is used for printing the Bluetooth stack and application trace messages. Open your terminal software and select the PUART COM port, with a baud rate setting of 115200 bps. If you want to disable the trace messages, then comment out the following line in the file motion_sensor.c:

wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );

4.      Add the code example to the IDE, in a new workspace. If you aren’t familiar with this process, see KBA225201.

Build and Program the Application: In the project explorer, select the <App Name>_mainapp project. In the Quick Panel, scroll to the Launches section, and click the <App Name> Build + Program configuration as shown in Figure 2. 

1.      After programming is complete the device will bootup, initializes the stack and start advertisement.

1.      To test a connection using the CySmart mobile app, follow the steps below

a.      Turn ON Bluetooth on your Android or iOS device.

b.      Launch the CySmart app.

c.      Swipe down on the CySmart app home screen to start scanning for BLE Peripherals; your device appears in the CySmart app home screen. Select your device to establish a BLE connection.

d.      Select the GATT DB from the carousel view.

e.      Select Unknown Service and then select Characteristics. This will trigger a pairing request. Allow the pairing when prompted. You might have to either type the passcode shown on your mobile in you TeraTerm terminal or compare the passcode displayed on you device to the one printed on TeraTerm.

f.        Select Notify. The BLE server device will start sending GATT notifications to the mobile device. It will also print the sensor values on TeraTerm. If the kit is stationary then the notifications will stop. To restart the notifications, give the kit a small jerk.

g.      Disconnect the Bluetooth connection by backing out from the mobile app. The device will start directed advertisement. You can either connect using the same BLE client device or press button SW3 to start undirected advertisement to connect with another BLE client device

Thanks,

Anjana

View solution in original post

0 Likes
Reply
10 Replies
Moderator
Moderator

Hello,

You may refer the attached demo which using motion sensor.

Thanks,
Anjana

New Contributor

Actually i need to make a Smart mail box using this board(by utilizing default motion sensor) which can notify users via the cypress mobile application.I have limited knowledge in the bluetooth low energy.So please help me to edit your code you have already given to make out my project.

I know that the wiced_platform.c, wiced_platform.h files contain the functions and macro definitions related to the initialization

of the hardware platform (CYW920819EVB-02 in this case), including the LEDs, buttons, and sensors used on the kit.

0 Likes
Reply
Moderator
Moderator

Hi Nera_4289606

The project which I shared already have BLE part included.

Below are steps to test the project.   

1.      Connect the kit to your PC using the provided USB cable.

2.      Connect a wire between the motion sensor interrupt and BLE device GPIO P02 as per Table-1

Kits

Motion Sensor Interrupt

BLE Device Connection

CYW920819EVB-02

J17.1

D4

CYW920820EVB-02

J17.1

D4

CYW920719B2Q40EVB-01

TP1

D6

CYW920721B2Q40EVB-01

TP1

D6

3.      The USB Serial interface on the kit provides access to the two UART interfaces of the CYW208xx/CYW207xx device – WICED HCI UART, and WICED Peripheral UART (PUART). The HCI UART is used only for downloading the application code in this code example and the PUART is used for printing the Bluetooth stack and application trace messages. Open your terminal software and select the PUART COM port, with a baud rate setting of 115200 bps. If you want to disable the trace messages, then comment out the following line in the file motion_sensor.c:

wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );

4.      Add the code example to the IDE, in a new workspace. If you aren’t familiar with this process, see KBA225201.

Build and Program the Application: In the project explorer, select the <App Name>_mainapp project. In the Quick Panel, scroll to the Launches section, and click the <App Name> Build + Program configuration as shown in Figure 2. 

1.      After programming is complete the device will bootup, initializes the stack and start advertisement.

1.      To test a connection using the CySmart mobile app, follow the steps below

a.      Turn ON Bluetooth on your Android or iOS device.

b.      Launch the CySmart app.

c.      Swipe down on the CySmart app home screen to start scanning for BLE Peripherals; your device appears in the CySmart app home screen. Select your device to establish a BLE connection.

d.      Select the GATT DB from the carousel view.

e.      Select Unknown Service and then select Characteristics. This will trigger a pairing request. Allow the pairing when prompted. You might have to either type the passcode shown on your mobile in you TeraTerm terminal or compare the passcode displayed on you device to the one printed on TeraTerm.

f.        Select Notify. The BLE server device will start sending GATT notifications to the mobile device. It will also print the sensor values on TeraTerm. If the kit is stationary then the notifications will stop. To restart the notifications, give the kit a small jerk.

g.      Disconnect the Bluetooth connection by backing out from the mobile app. The device will start directed advertisement. You can either connect using the same BLE client device or press button SW3 to start undirected advertisement to connect with another BLE client device

Thanks,

Anjana

View solution in original post

0 Likes
Reply
New Contributor

Hi anjana,

It is showing error that..

Elf file C:/Users/ADMIN/mtw/EmptyWicedBluetooth_mainapp/Debug/EmptyWicedBluetooth_mainapp.elf not found

C:/Users/ADMIN/mtw/EmptyWicedBluetooth_mainapp/Debug/mainapp_download.hex may be stale, try to clean and rebuild all

0 Likes
Reply
New Contributor

when i try to build the code.

0 Likes
Reply
Moderator
Moderator

Hi,

I have reattached the project zip file. Can you please try importing again?

Please follow the below steps:

  1. Open Modus tool box.
  2. Open File -> New -> ModusToolboxIDEApplication
  3. Select 20819 and click 'Next'
  4. Click on 'Import' button and select modus.mk file of motion sensor project location
  5. Click 'Next' and 'Finish'
  6. Now MotionSensor_mainapp project should open in the IDE
  7. Now open design.modus and click on File -> Save
  8. Now click on Build MotionSensor Application

Please try the above , it should build successfully.

Thanks,

Anjana

0 Likes
Reply
New Contributor

Madam, can you please provide any of your contact details to my email nekiary07@gmail.com so that I can reach you faster with my doubts and can avoid unwanted delay by posting doubts in the community.

0 Likes
Reply
Moderator
Moderator

Hi Nekhil ravi ,

I am sorry, as per policy we don't have that option.

You may always create new thread on  the forum whenever you face any issues.

We may help you out here.

Thanks,
Anjana

0 Likes
Reply
New Contributor II

Is there a reason the address is always bit-shifted to the right by 1? I don't see a clear reason for that in the documentation but when implementing that in my own design it fixes the communication errors. Normally I2C addresses are not bit-shifted when used in software APIs

0 Likes
Reply
Moderator
Moderator

Hi Ryan,

The right shifting of I2C address in the example project is to make the I2C address of motion sensor IC (LSM9DS1 - https://www.st.com/resource/en/datasheet/DM00103319.pdf ) to be compatible with our I2C read / write APIs in WICED .

Thanks,
Anjana

0 Likes
Reply