Freedom KL25Z from Freescale Semiconductor is a popular board based on KL25 ARM Cortex M0+ micro-controller. There are many tutorials and examples available for using many features of the FRDM-KL25Z board. This blog describes the implementation of USB host interface to support a low cost Bluetooth dongle along with 3-axis accelerometer and PWM features.
Bluetooth connectivity for FRDM-KL25Z
Interfacing the Bluetooth USB dongle to the board is the important step for the demo. To enable using low cost devices, the demo uses low cost dongles available in local stores under 2 dollars. These devices generally uses CSR chipset module inside.
About connecting the dongle to the board, follow the procedure outlines in this MCUOnEclipse blog.
This link provides the detailed description of USB host mode hack for the FRDM KL25Z board. Another option is to modify header “J21” (Refer sheet3 in Freedom KL25Z schematics with document number SCH-27556 or SPF-27556).
For 3 Axis accelerometer support, the on-board MMA8451Q chip is used. It is connected to KL25 MCU via I2C interface. I2C0 port in pins PTE24 and PTE25 is used for the interface.
The on-board tri-color LED is utilized for PWM implementation. The Red LED of tri-color LED is connected to the PWM pin TPM2_CH0 of PTB18, Green LED is connected to TPM2_CH1 of PTB19 and blue LED is connected to TPM0_CH1 of PTD1.
For this demo, the power to the board is provided through the openSDA USB Mini-B connector “J7”.
The firmware initially prepares all the underlying hardware interfaces. The USB stack first prepares the USB OTG controller for host operation. Once done, it enumerates the attached device. Once a valid Bluetooth Dongle is detected, it configures the same and brings up the various layers of the Bluetooth stack like HCI, L2CAP, RFComm etc. Once a logical channel is established between the FRDM-KL25 board and dongle, the data is transferred in a custom format.
Upon detection of change in accelerometer reading, the 3 axis data is read and sent to the Android application over Bluetooth by adding a header field in the front and footer in the end. Up on recognizing the packet, the application calculates the position and renders the 3D image of the board in the display using OpenGLES routines.
Similarly on change of LED colour values by the user, the data is send in custom frame format to the board over Bluetooth. The firmware decodes the same and drives the 3 components of the LED in different brightness values using PWM modulation.
The demo of Bluetooth Stack on FRDM-KL25Z is available as a video in the below link.
All the necessary firmware to run in the FRDM board can be downloaded from our downloads page.
With Bluetooth, especially Bluetooth Low Energy (BLE) is being used more and more in IoT applications like activity trackers, health bands etc, such a stack will be an advantage when integrating the functionality on top of USB host using low cost USB dongles.
About Embien Technologies: Embien Technologies is a leading provider of embedded design services for the Semi-conductor, Industrial, Consumer and Health Care segments. Our extensive experience in working with wireless technologies like Bluetooth, Bluetooth Low Energy (Bluetooth Smart), RFID, ZigBee, WiFi etc enables us provide solutions to customer quickly at an unmatched quality at a very low price point. Feel free to contact us for any of your connectivity, OpenGL, mobile application or embedded product development requirements.
Please fill in this form to subscribe our blog.
In this blog, we will discuss in detail about the camera interface and data flow in Jetson Tegra platforms and typical configuration and setup of a MIPI CSI driver. For specifics, we will consider Jetson Nano and Onsemi OV5693 camera.
In this blog, we will explore the scope for No-Code and Low-Code development for embedded systems and how Flint tool can help realize the same for this field.
Now a days in 2022 due to technology growth, a product is having multiple features/use cases and it has been upgraded for bug fixes and new features in the interest of customer/end.
In any vehicle, the instrument cluster forms a critical part as it is the face of the vehicle that reflects the current state.