how to use gpio pins in nRF52840 development kit? - gpio

The GPIO pins are like P0.00, P0.01, P1.01, P1.02 and so on. I didnt know how to use this.
I would like to know, how to use the GPIO pins in nRF52840 for simple LED and push button circuit?
It would be really helpful.

The GPIO pins on the nRF52840 development kits are mapped as follows:-
P0.00 - P0.31 : SIO0 - SIO31
P1.00 - P1.15 : SIO32 - SIO47
In other words, P0.01 is SIO1, P1.01 is SIO33, P1.02 is SIO34 and so on. The macro mapping can be found in Nordic_SDK/modules/nrfx/hal/nrf_gpio.h (Line 71).

Related

device tree, change fixed link ethernet phy speed runtime

I'm working with a custom IMX8 board with a phy that is not supported by the Linux kernel (it's a clause 45 automotive oabr transceiver).
The phy is actually working, and its mdio bus and digital IO's are controlled with an userspace application.
To acheive this i had to bind it in the device tree with the fixed-link property as below.
...
port#0 {
reg = <0x00>;
label = "oabr";
phy-mode = "rgmii";
fixed-link {
speed = <1000>;
full-duplex;
pause;
asym-pause;
};
};
...
Now... the question is, i would like to change the speed of the phy from 1000 to 100, i'm able to do it if configure the phy AND change the device tree, but this implies a reboot of the device to load a new dts file.
Is there a way to get it working runtime?
Thanks a lot,
Marco
In order to add or load a device tree blob in runtime, the only way is to use Linux overlay.
But the problem is that NXP does not support it in its linux-imx kernel , you can see their post about it here.
If you don't make the change permanently to your main device tree file used for the image, I can advise you of doing this:
Create another dts (Ex: new-phy.dts) that includes the main dts and add your override node there
Add the new dtb name to your ${MACHINE}.conf KERNEL_DEVICETREE variable:
KERNEL_DEVICETREE += "freescale/new-phy.dtb"
Now you need to choose it once you boot from u-boot CLI, like:
u-boot> setenv fdt_file new-phy.dtb
u-boot> saveenv
u-boot> boot
Or, you can set it in your u-boot/configs/${MACHINE}_defconfig:
CONFIG_DEFAULT_FDT_FILE="new-phy.dtb"
Otherwise, you can try to add the overlay support for the kernel you are using.
Toradex has SOMs and EVKs based on IMX8M and they are working with overlays, you can take a look here and try to understand what they did to support it.

GPIO register base address on Raspberry Pi 4

According to the document "BCM2711 ARM Peripherals" Version 1, 5th February 2020, at page 83, "The GPIO base address is 0x7E21 5000."
(The link to the document is this: BCM2711 ARM Peripherals.)
From the command prompt, when I enter, "cat /proc/iomem", it displays, among other things, "gpio#7e200000".
My question is: Shouldn't these numbers be the same?
Yes, these numbers should indeed be the same.
Today I discovered that there is an error in the BCM2711 ARM Peripherals datasheet, also see this GitHub issue.
The correct GPIO base address is 0x7E20 0000.

Can not configure 5GHz WiFi band for Beaglebone AI

I am trying to configure 5GHz WiFi band for my new Beaglebone AI.
What I am doing is
cp /tmp/hostapd-bbai.conf to /etc/hostapd.conf
opening /etc/default/bb-wl18xx and changing USE_GENERATED_HOSTAPD to 'no'
USE_GENERATED_HOSTAPD=no
in order to use /etc/hostapd.conf file instead of generated conf file from /tmp
this method works perfect for 'b' and 'g' but I can not configure to 'a' in order to use 5GHz band
Can anyone help me regarding this?
this is my hostapd.conf
interface=SoftAp0
ssid=BeagleBone-59A4
hw_mode=a
channel=1
wmm_enabled=1
country_code=IN
ieee80211d=1
ieee80211n=1
ieee80211ac=1
wmm_enabled=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=BeagleBone
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
logger_syslog=-1
logger_syslog_level=2
New Beagle Bone AI WIFI stack is more powerful and its auto handle.
if still you facing issue regarding any other interfaces then please follow below link :
https://github.com/MalavPatel3501/BeagleBone-AI--mpBBAI-IO-Python-Library
In this project you got .dts file and all pin muxing steps. Moreover i puts some example code in this project.

How to select a particular USB port on raspberry pi 3B+ to program two arduino boards with arduino-mk?

I have a python program on my Raspberry pi 3B+ witch updates an Arduino mega2560 and an Arduino Uno by using Arduino-mk through bash commands. Each Arduino has its own code folder with its code (.ino) and a Makefile which looks like:
ARDUINO_DIR = /usr/share/arduino
ARDUINO_PORT = /dev/ttyUSB0 (here is the problem)
USER_LIB_PATH = /home/pi/sketchbook/libraries
BOARD_TAG = mega2560 (Uno for the uno one)
include /usr/share/arduino/Arduino.mk
When I call the following command:
os.system("(cd ~/sketchbook/mega; make upload clean)")
with only the mega connected on the USB port everything works and the mega gets programed (same with Uno only). but when I try to get both done:
os.system("(cd ~/sketchbook/mega; make upload clean)")
os.system("(cd ~/sketchbook/uno; make upload clean)")
arduino-mk can't program the Uno (multiple timeouts).
At first the second line in Makefile was:
ARDUINO_PORT = /dev/ttyAMC0
but it was not working so I checked on the web and found that some Arduino copies worked better with:
ARDUINO_PORT = /dev/ttyUSB0
Then it worked but I couldn't get any result with ttyUSB1 up to ttyUSB3 (I hoped it would work like COM ports on windows).
I also noticed that if I keep testing with ttyUSB0 and try with each physical USB port and worked so ttyUSB0 refers to the four physical ports right?
Please how can I get one particular port name?
Or is there an other way to make Arduino-mk work?
Plug in one device at a time and look at the output of ls -l /dev/serial/by-id/, you should see a symlink to the actual device node, but uniquely named for your specific device.
You can then set ARDUINO_PORT=/dev/serial/by-id/unique_name in the respective makefiles.

PyUSB Barcode Scanner without Button by Honeywell

I have a Honeywell N5600 that I'm trying to use, but I don't get it to scan anything.
The device is recognized as /dev/hidraw1, but as it does not have any button to press, I cannot trigger the scan and thus, when I try to read from it, it just waits forever.
I started creating a python program, that seems to be able to communicate with it (different return values):
VENDOR_LEGO = 0x0c2e
PRODUCT_EV3 = 0x0967
device = usb.core.find(idVendor=VENDOR_LEGO, idProduct=PRODUCT_EV3)
device.detach_kernel_driver(0)
#"TRGMOD8." would - when scanned (which I cannot do, at this point) - activate a permanent scanning mode
device.ctrl_transfer(0x21, 0x9, wValue=0x200, wIndex=0x00, data_or_wLength='TRGMOD8.')
#8 is returned
device.ctrl_transfer(0x21, 0x9, wValue=0x200, wIndex=0x00, data_or_wLength='PAPSPC.')
#7 is returned
Unluckily the link given in this post is not reachable anymore. It seems like it would have solved my problem.
How can I activate the scanning?
The document on Honeywell N5600 is as follows.
N5600 OEM 2D Imager Data Sheet
N56XX Decoded Engine User's Guide
You need a Windows PC that can connect to the Internet, but there is a tool called EZConfig-Scanning that configures and maintains the scanner.
EZConfig Device Management Data Sheet
Perhaps the recognition device /dev/hidraw1 is probably because the scanner is set to USB HID Bar Code Scanner mode.
If you change the setting to USB Keyboard(PC/Mac), it is always readable and the barcode you read will be notified as keyboard input.
By changing the setting to USB Serial, reading start/stop can be controlled by SerialPort command transmission. The barcode read is notified by receiving data from SerialPort.

Resources