Cool-Emerald
Our thoughts and memories...
Saturday, August 5, 2023
DIY USB Video Camera Using MK82FN256VLL15 Microcontroller and OV7670 Camera Module
FRDM-K82F
is a low cost development board using MK82FN256VLL15 microcontroller.
Here, I will test its FlexIO connector using OV7670 camera module.
[NXP16,
NXP16B]
Wednesday, November 30, 2022
Translation and Rotation of Images in Six Degree of Freedom Using OpenCV
I would like to share a small C++ function to translate and rotate images in 3D space in six degree of freedom (6 DoF).
It also adjusts brightness and contrast. I use OpenCV library to perform some image processing.
Monday, November 7, 2022
Near Field Communication (NFC) Using PN7150RPIM
Using OM5578 PN7150 NFC controller with Raspberry Pi is discussed.
The Raspberry Pi version is used as SBC interface for this discussion. Its connections to the header is shown in the following Figure [3].
Then, navigate into the directory and generate the configuration script. The machine should have automake, autoconf and libtool packages installed before running the script.
There are three options to generate the Makefile to map Linux NFC stack-
The i2c bus and GPIO pin can be configured in phTmlNfc_alt.h which is in ./src/halimpl/pn54x/tml/i2c directory. The existing values are
Execute the following commands to generate the Makefile for the above settings, build and install the library.
The install path is at /usr/local/lib. And for that you can use
or create config file as follows.
And load the configuration.
Then, you can navigate into an example directory, build, and run.
url: https://www.nxp.com/docs/en/application-note/AN11758.pdf.
[2] NXP Semiconductors. PN7150 NFC Controller SBC Kit User Manual. 2019-07-10.
url: https://www.nxp.com/docs/en/user-guide/UM10935.pdf.
[3] NXP Semiconductors. NFC's SBC Interface Boards User Manual. 2016-05-02.
url: https://www.nxp.com/docs/en/user-guide/UM10956.pdf.
[4] NXP Semiconductors. PN71xx Linux Software Stack Integration Guidelines. 2018-08-10.
url: https://www.nxp.com/docs/en/application-note/AN11697.pdf.
[5] NXP Semiconductors. Easy set-up of NFC on Raspberry Pi. 2018-08-14.
url: https://community.nxp.com/docs/DOC-341231.
[6] NXP Semiconductors. linux_libnfc-nci_examples.
url: https://github.com/NXPNFCLinux/linux_libnfc-nci_examples.
Hardware Module
PN7150RPIM demo kit consists of PN7150 controller which is soldered on Raspberry Pi Interface board. It also includes NTAG216 a NFC card for testing [1]. There are three different versions of interface board for PN7150 NFC controller - Raspberry Pi interface, BeagleBone interface, or Arduino interface [2]. As illustrated in Figure 1, it only uses 6 pins - 3.3V, and GND for power, SDA and SCL for I2C, a GPIO input IRQ for interrupt, and a GPIO output for Enable pin. There is also an optional 5V power VANT.The Raspberry Pi version is used as SBC interface for this discussion. Its connections to the header is shown in the following Figure [3].
Library
There is NXP Linux libnfc-nci software stack on GitHub that supports PN7150 NFC controller [4] which we will clone as follows.$ sudo apt install autoconf automake libtool git pkg-config $ git clone https://github.com/NXPNFCLinux/linux_libnfc-nci.git
Then, navigate into the directory and generate the configuration script. The machine should have automake, autoconf and libtool packages installed before running the script.
$ cd linux_libnfc-nci/ $ ./bootstrap
There are three options to generate the Makefile to map Linux NFC stack-
- --enable-i2c
- To use PN5xx I2C kernel mode driver which is default.
- --enable-alt
- To access GPIO and I2C resources from the user space in case the existing kernel offers access to them.
- --enable-lpcusbsio
- For USB devices implementing PN7150 with HID interface expose via LPCUSBSIO. protocol.
The i2c bus and GPIO pin can be configured in phTmlNfc_alt.h which is in ./src/halimpl/pn54x/tml/i2c directory. The existing values are
#define I2C_BUS "/dev/i2c-1" #define I2C_ADDRESS 0x28 #define PIN_INT 23 #define PIN_ENABLE 24
Execute the following commands to generate the Makefile for the above settings, build and install the library.
$ ./configure --enable-alt $ make $ sudo make install
The install path is at /usr/local/lib. And for that you can use
$ export LD_LIBRARY_PATH=/usr/local/lib
or create config file as follows.
$ sudo sh -c "echo /usr/local/lib/ > /etc/ld.so.conf.d/nfc-nci.conf"
And load the configuration.
$ sudo ldconfig
C++ Examples
Example C++ programs to use NXP Linux libnfc-nci software stack as reader, emulator, etc. are also available on GitHub [6] which we will clone as follows.$ git clone https://github.com/NXPNFCLinux/linux_libnfc-nci_examples
Then, you can navigate into an example directory, build, and run.
$ cd linux_libnfc-nci_examples/xxxx $ make $ ./xxxx
References
[1] NXP Semiconductors. PN7150 Raspberry Pi SBC Kit Quick Start Guide. 2019-07-08.url: https://www.nxp.com/docs/en/application-note/AN11758.pdf.
[2] NXP Semiconductors. PN7150 NFC Controller SBC Kit User Manual. 2019-07-10.
url: https://www.nxp.com/docs/en/user-guide/UM10935.pdf.
[3] NXP Semiconductors. NFC's SBC Interface Boards User Manual. 2016-05-02.
url: https://www.nxp.com/docs/en/user-guide/UM10956.pdf.
[4] NXP Semiconductors. PN71xx Linux Software Stack Integration Guidelines. 2018-08-10.
url: https://www.nxp.com/docs/en/application-note/AN11697.pdf.
[5] NXP Semiconductors. Easy set-up of NFC on Raspberry Pi. 2018-08-14.
url: https://community.nxp.com/docs/DOC-341231.
[6] NXP Semiconductors. linux_libnfc-nci_examples.
url: https://github.com/NXPNFCLinux/linux_libnfc-nci_examples.
Wednesday, July 6, 2022
Zint Barcode Generator
Zint is a cross-platform open source barcode generating library which can be found at
https://www.zint.org.uk/.
You can get zint from the following github repository.
https://github.com/woo-j/zint.
https://www.zint.org.uk/.
You can get zint from the following github repository.
https://github.com/woo-j/zint.
Friday, April 1, 2022
PCA9535 GPIO Expander
PCA9535
is a GPIO expander with 16 IO lines which has I2C bus interface.
It provides additional IOs for I2C bus master such as SBC or MCU that can be used to read push button or sensor, to control LED, etc.
PCA9555 is identical to PCA9535 except the presence of internal pull-up resistor
which increases power consumption when the IOs are low.
PCA9535C is another variation of PCA9535 with open drain outputs.
Its operating supply voltage range is 2.3V to 5.5V.
There are 3 hardware pins which allow to use 8 different I2C bus addresses, from 0x20 to 0x27.
Wednesday, March 2, 2022
Software timers and Ring Buffered UART Com for LPC824 MCU
In this article, I would like discuss about using
LPC82x MCU with MCUXpresso IDE.
I will use
LPCXpresso824-MAX Board as a hardware platform.
Tuesday, October 5, 2021
16 Channel RS485 Modbus Relay Board
Controlling a
16 channel RS485 Modbus relay board is discussed in this post.
The board needs to be powered with a 12V power supply.
It has has a DIP switch to set its ID. If only the switch 1 is on and others are off, its ID will be 1.
To communicate the board from a PC, a USB to RS485 converter can be used. The setup is illustrated in the following figure.
Alternatively, you can use a USB UART adapter together with a UART to RS485 converter. Wire connection for this setup is shown below.
Unlike conventional RS485 devices, these devices do not have the control line for transmit or receive. They use autoflow control as shown below.
Alternatively, you can use a USB UART adapter together with a UART to RS485 converter. Wire connection for this setup is shown below.
Unlike conventional RS485 devices, these devices do not have the control line for transmit or receive. They use autoflow control as shown below.
Friday, September 17, 2021
V4L2 Capturing as Bitmap Image
V4L2 (Video for Linux 2) consists of drivers and API for video capturing on Linux
[1].
In this article, we will discuss about using the library and analysis of video capture example.
There are utilities for controlling media devices on Linux called v4l-utils
[2].
We will explore about using and testing webcam with them also.
Wednesday, July 7, 2021
K82 USB CDC Virtual Comm
In this article, we will discuss about using K82 as a USB CDC virtual com device.
Setting up environment for K82 development is discussed in previous article at the following link.
http://cool-emerald.blogspot.com/2020/01/getting-started-with-frdm-k82f.html
http://cool-emerald.blogspot.com/2020/01/getting-started-with-frdm-k82f.html
Monday, July 5, 2021
Software timers and Ring Buffered UART Com for Kinetis K82 MCU
In this article, I would like discuss about using
Kinetis K82 MCU with MCUXpresso IDE.
I will use
FRDM-K82F development board as a hardware platform.
Setting up environment for K82 development is discussed in previous article at the following link.
http://cool-emerald.blogspot.com/2020/01/getting-started-with-frdm-k82f.html
http://cool-emerald.blogspot.com/2020/01/getting-started-with-frdm-k82f.html
Subscribe to:
Posts (Atom)