BeagleBone Black MRF24j40 - arduino

I am trying to get a MRF24j40 on a BeagleBone Black to talk to an arduino with a mrf24j40. I have successfully communicated arduino to arduino but as of yet have not been able to receive the packets being sent out on the BBB.
The setup: I have GPIO_13 going to reset (pin 2), GPIO_14 going to wake (pin 3) and GPIO_29 going to interrupt (4). The 3.3v is going to vin on 10 and ground on pin 1. I am using SPI1 with the HDMI ports disabled. D0 is mapping to pin 7 (SDO) and D1 is mapping to pin 5 (SDI), P9.31 the clock goes to pin 6 and P9.28 goes to pin 8.
I have been able to log into the BBB via ssh. I then load the cape for the MRF24j40 using the echo to /sys/devices/bone_capemgr.9/slots
This appears to load the driver properly.
I have then been able to do:
iz listphy
iz: /lib/arm-linux-gnueabihf/libnl-genl-3.so.200: no version information available (required by iz)
iz: /lib/arm-linux-gnueabihf/libnl-3.so.200: no version information available (required by iz)
wpan-phy0 IEEE 802.15.4 PHY object
page: 0 channel: n/a
channels on page 0: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
iz add wpan-
iz: /lib/arm-linux-gnueabihf/libnl-genl-3.so.200: no version information available (required by iz)
iz: /lib/arm-linux-gnueabihf/libnl-3.so.200: no version information available (required by iz)
Registered new device ('wpan0') on phy wpan-phy0
I decided to set all my addresses to simple things on the arduino side in case there is some sort of endian problem so the pan id is 0, the address of the sender is 0 and it sends the data to 1, thus I try to set the beaglebone to pan id 0, address 1 with a destination address of 0.
root#beaglebone:~# iz set wpan0 0 1 12
iz: /lib/arm-linux-gnueabihf/libnl-genl-3.so.200: no version information available (required by iz)
iz: /lib/arm-linux-gnueabihf/libnl-3.so.200: no version information available (required by iz)
ifconfig wpan0 up
Then I run
izchat 0 1 0
I get nothing on the BBB side even though the other side is constantly transmitting... and when I type into izchat, I do not receive anything on the other side.
Any help here would be appreciated... I just want to see some data before I start coding. Like I said, this has been tested arduino to arduino and does not have problems.

Related

Problem Flashing nrf52 chip using Openocd

I have a custom nrf52 chip on a pcb with swd pins exposed. I have cloned and installed the latest openocd from https://github.com/ntfreak/openocd. The latest version includes all the latest pathes for the nrf52 chip, so no need for any additional changes as suggested in many older guides online. I am able to connect to the chip using ST-LinkV2. when connected I can read and write memory locations using mdw and mdb. I can also run some basic openocd commands like dump_image e.t.c, which confirms that the setup is good. But halt and program commannds always lead to errors like:
JTAG failure -4
JTAG failure -4
JTAG failure -4
JTAG failure -4
JTAG failure -4
JTAG failure -4
target halted due to debug-request, current mode: Thread
xPSR: 00000000 pc: 00000000 msp: 00000000
jtag status contains invalid mode value - communication failure
Polling target nrf52.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Previous state query failed, trying to reconnect
jtag status contains invalid mode value - communication failure
Polling target nrf52.cpu failed, trying to reexamine
if I try to use flash image_write I get the error,
JTAG failure
Error setting register
error starting target flash write algorithm
Failed to enable read-only operation
Failed to write to nrf52 flash
error writing to flash at address 0x00000000 at offset 0x00000000
in procedure 'dap'
jtag status contains invalid mode value - communication failure
Polling target nrf52.cpu failed, trying to reexamine
I have read different guides online, and one of the possible solutions involves the APPPROTECT register which has to be disabled to enable any writes to flash.
APP_PROTECT, But the dap commmand which is supposed to help us access this bit,
dap apreg 1 0x04 0x01
returns an error:
invalid subcommand apreg 1 0x04 0x01
Please, I will like to know if anyone has had success programming a new empty nrf52 chip with the stlink-v2 and the steps which are necessary, or if any one has encountered similar problems. Thanks.
Here is my config file:
#nRF52832 Target
source [find interface/stlink.cfg]
transport select hla_swd
source [find target/nrf52.cfg]
#reset_config srst_nogate connect_assert_srst
I solved the "protected nRF52" chip problem this way, on Windows, using a Particle.io Debugger https://store.particle.io/products/particle-debugger setup to program nRF52 chips from Arduino as described in https://www.forward.com.au/pfod/BLE/LowPower/index.html
Note: The recovery process described here does NOT need Arduino to be installed
Download OpenOCD-20181130.7z pre-compiled openocd for windows from
http://gnutoolchains.com/arm-eabi/openocd/
The latest version of openocd src on https://github.com/ntfreak/openocd should also work as it includes the apreg cmd in target\arm_adi_v5.c
unzip, open cmd prompt to unzip dir, enter cmd
bin\openocd.exe -d2 -f interface/cmsis-dap.cfg -f target/nrf52.cfg
response
Info : auto-selecting first available session transport "swd". To override use '
transport select <transport>'.
adapter speed: 1000 kHz
cortex_m reset_config sysresetreq
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 1.10
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Error: Could not find MEM-AP to control the core
Info : Listening on port 3333 for gdb connections
Open telnet program eg teraTerm and connect to localhost on port 4444, i.e. 127.0.0.1 telnet port 4444
cmd window shows
Info : accepting 'telnet' connection on tcp/4444
in telnet (i.e. teraTerm) type
nrf52.dap apreg 1 0x04
returns 0 <<< chip protected
then
nrf52.dap apreg 1 0x04 0x01
then
nrf52.dap apreg 1 0x04
returns 1 << chip un-protected
then power cycle board
Can now use arduino ide to flash softdevice and code low power BLE
Even though the dap command is listed by openOCD help, it isn't implemented for transport hla_swd that you have to use with ST-Link.
If the ST-Link is a generic type from China, it can be upgraded to CMSIS-DAP which uses the swd transport and supports the nrf52.dap apreg 1 0x04 0x01 command to disable the readback protection and erase the flash. You'll need another ST-Link to do that, or you can instead install CMSIS-DAP on a generic STM32F103C8T6 board.
After that you can either use ST-Link to program the nRF52 or continue using CMSIS-DAP, which can also be used to program STM32 MCU.
Nucleo board embedded ST-Links can also be upgraded to J-Link, which allow the use of the "recover" option in nRFgo Studio to erase the flash, it should also work with "nrfjtool --recover" or OpenOCD.
If anyone encounters this problem, I solved the problem by getting an original Jlink-Edu. I also had to pull the reset pin of the microcontroller high to get the jlink working.
There are lots of JTAG messages.
I think you might be missing the
transport select hla_swd
line in your (board) cfg file. The NRF5x chips only work properly with SWD, and ST-Link uses the hla_swd variant.

Raspberry pi 3 Serial Communication

I want to connect an 5" HDMI display (26 header pins) to a Raspberry Pi 3. I also want to use UART0 (Tx=GPIO14, Rx=GPIO15).
So I remapped UART 0 to Tx=GPIO36 and RX=GPIO37 by using the command in config.txt file:
dtoverlay=uart0 ,txd0_pin36,rxdo_pin=37,pin_func=7 # alt 3
I also included the following commands in rc.local:
raspi-gpio set 14 ip
raspi-gpio set 15 ip
On entering raspi-gpio get command, I am getting TXD0 and RXD0 enabled at GPIO14, GPIO15 and GPIO36, GPIO37 respectively, but still serial communication is not working. Though it was working on GPIO14, GPIO15.
Now how to enable serial communication on GPIO36, GPIO37?

GSM modem stops responding after CMGL and CMGR commands

I have an LG B470 flip phone. I want to be able to send and receive text messages from my Mac Laptop running OS X 10.10.5.
I have the phone plugged in via USB. I can send SMS messages using the minicom terminal. However, attempting to list or read SMS messages from the phone/modem causes the modem to stop responding:
AT
OK
ATI
Manufacturer: LG ELECTRONICS
Model: LGB470
Revision: LGB470-QSC6270-V10c-JAN-11-2016-ATT-US 1 [JAN 11 2016 22:00:00]
SVN: 01
IMEI: 359926084167819
+GCAP: +CGSM,+DS,+ES
OK
AT+CPMS?
+CPMS: "ME",15,500,"ME",15,500,"SM",0,30
OK
AT+CMGF=1
OK
AT+CMGS="+12146168895"
> Hello World.
+CMGS: 169
OK
AT+CMGL="ALL"
I get no response and can no longer communicate at all. Typing is not echoed back and if I turn local echoing on and attempt to send the AT command I get no response. The only way to get the modem to respond is by restarting the phone (unplugging and plugging back in the phone's USB, etc. does not help).
The same thing happens after AT+CMGR commands.
Question
Why does the phone/modem stop responding after AT+CMGL and AT+CMGR commands? How can I fix this so I can get incoming SMS messages from my phone to my mac? Any tips on how to debug?
Setup
I did not install any drivers. When I plugged my phone into my mac via USB it was recognized automatically. It is shown as an internet modem in System Preferences->Network. Some character devices were also created:
$ ll /dev/tty.*
crw-rw-rw- 1 root wheel 18, 4 Apr 20 13:27 /dev/tty.BIGJAMBOXbyJawbone-SPPD
crw-rw-rw- 1 root wheel 18, 2 Apr 20 13:27 /dev/tty.Bluetooth-Incoming-Port
crw-rw-rw- 1 root wheel 18, 0 Apr 20 13:27 /dev/tty.Bluetooth-Modem
crw-rw-rw- 1 root wheel 18, 6 Apr 20 13:27 /dev/tty.LGB470-LGPCSuite
crw-rw-rw- 1 root wheel 18, 12 Apr 20 13:46 /dev/tty.lgusbmodem1411
crw-rw-rw- 1 root wheel 18, 14 Apr 20 13:46 /dev/tty.lgusbserial1411
tty.lgusbmodem1411 (lg usb modem 1411) and tty.lgusbserial1411 (lg usb serial 1411) disappear and reappear when I unplug and plug in the phone's USB. tty.LGB470-LGPCSuite is always there and seems to reference the LG PC Suite software which is not compatible with my phone.
I can also connect to it via Bluetooth and transfer files via the "Bluetooth File Exchange" app.
minirc.dfl:
pu port /dev/tty.lgusbmodem1411
pu lock /usr/local/Cellar/minicom/2.7.1/var
pu escape-key Escape (Meta)
Additional Info
As reported by the ATI command, my LGB470 phone uses the Qualcomm QSC6270 "HEDGE (HSDPA/WCDMA and GSM/GPRS/EDGE)" chipset. I can not find documentation on the GSM modem/AT commands, however.

Unable to upload code to a NodeMCU Board

I have 4 NodeMCU boards, 3 of them I can use and 1 I can't seem to upload any of my code to. It does boot, and I can get a readout of it on the serial port.
On boot:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79
2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 # 1000
rf[112] : 03
rf[113] : 00
rf[114] : 01
SDK ver: 1.5.4(baaeaebb) compiled # May 17 2016 19:23:54
phy ver: 972, pp ver: 10.1
I also tried doing a reset with the flash button held down:
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
I don't get any compile errors with my code, and the code works perfectly fine on the other 3 NodeMCU boards. When I try to upload (regardless of boot mode) I see the blue light near the ESP8266 chip blink a couple of times, and then I get the following errors output:
Sketch uses 230061 bytes (22%) of program storage space. Maximum is 1044464 bytes.
Global variables use 34612 bytes (42%) of dynamic memory, leaving 47308 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
I've also tried grounding D0 and connecting the EN pin to 3.3v, which changes the boot mode to ets Jan 8 2013,rst cause:2, boot mode:(1,7) and the red onboard LED turns on, but still doesn't allow me to upload code.
ENVIRONMENT (these settings work on all my other NodeMCU Boards and I did confirm this is a 1.0 board)
IDE: Arduino 1.8.0
Board: NodeMCU 1.0 (ESP-12E)
CPU: 80 MHz
Flash Size: 4M (3M SPIFFS)
Upload Speed: 115200

El capitan pololu isp dongle pgm03a not working anymore

I have a Pololu PGM03A isp dongle to programm microcontrollers via avrdude. It worked great under Yosemite, but under El Capitan, it seems to disconnect and reconnect randomly every 1 - 5 sec. I can see this by the green status LED and in the terminal:
Macintosh:~ xxxxx$ ls /dev/cu.*
/dev/cu.Bluetooth-Incoming-Port /dev/cu.usbmodem00070153
/dev/cu.serial1 /dev/cu.usbmodem2169
/dev/cu.usbmodem00070151
Macintosh:~ xxxxx$ ls /dev/cu.*
/dev/cu.Bluetooth-Incoming-Port /dev/cu.usbmodem00070153
/dev/cu.serial1
Macintosh:~ xxxxx$ ls /dev/cu.*
/dev/cu.Bluetooth-Incoming-Port /dev/cu.usbmodem00070153
/dev/cu.serial1 /dev/cu.usbmodem2177
/dev/cu.usbmodem00070151
As you can see, the usbmodem00070151 is there, then not, and then again available. The usbmodem00070153 belongs to the ISP Dongle too, but it provides an different feature than programming the microcontroller (it's an USART Port or something I think).
Edit: The latter modem now also disconnects.
When I try to flash the microcontroller, it sometimes manages it to write some bytes, but the time between 2 disconnects is to short to finish the job:
Writing | ######################## | 47% 0.08s
avrdude: ser_recv(): read error: Device not configured
make: *** [all] Error 1
Does anyone know how to fix this?

Resources