Attempting to get BG96 connected - arduino

I have been trying to get a BG96 connected using only AT commands with no luck.
I have good signal strength, but something is still wrong.
I can run: at+cereg?;+cgreg?;+cops?;+qcsq;+qnwinfo
and in return I get:
+CEREG: 0,2
+CGREG: 0,4
+COPS: 0
+QCSQ: "NOSERVICE"
+QNWINFO: No Service
OK
I am attempting to connect to Soracom.io (apn: soracom.io, username: sora password: sora)
After waiting some time, I do get:
AT+QCSQ
+QCSQ: "CAT-M1",-64,-89,219,-9
I AM able to get this card to connect with a different manufacturers dev board. but not my current dev board (skylink) though it is still a BG96 chip.
Any ideas as to why this will not connect???
Thanks!

Related

What does pl2303 "error sending break" mean?

I have a problem with my pl2303 converter. I'm using two of them like this:
LAPTOP <-USB-SERIAL-> <-SERIAL-SERIAL-> <-SERIAL-USB-> RASPBERRYPI
In other words, I'm connecting Raspberry Pi with my laptop using two usb-to-serial converters and having null modem in the middle.
I can communicate through minicom and "visually" it looks fine (all information is sent properly), but when I look into the logs it produces following dmesg output:
[ 343.390610] pl2303 ttyUSB1: pl2303_get_line_request - failed: -32
[ 343.685367] pl2303 ttyUSB1: error sending break = -32
I could live with that as long as everything works fine... but it doesn't. For example, I can't connect with RPi via ser2net. The "other side" simply doesn't get the messages. I suspect that this error is the cause of this problem. I was googling around, but I didn't find any solution. Could somebody help me with it?
Also - when I try to connect via ser2net, one thing breaks. Before that I can to stuff like
cat -v < /dev/ttyUSB0
and
echo "blablabla" > /dev/ttyUSB0
with success. After I try to connect via ser2net, it stops working and only minicom communication is fine.

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.

Changing MAC address for wifi interface in OpenWrt Chaos Calmer 15.05.1

I have configured one OpenWrt (lets call it child) to boot from sd card which has the firmware and software re-imaged from another OpenWrt (lets call it maker) as per following: http://labs.mediatek.com/forums/posts/list/3619.page#p7191.
Everything works fine except for the issue where wlan interface of child and maker are showing the same MAC address, the one of maker. Due to this I can connect to only one of them if they both are in AP mode.
I have tried giving 'macaddr' option in 'wifi-device', 'wifi-iface' but nothing works. I have also tried setting hardware address using command:
ifconfig ra0 hw ether 'XX:XX:XX:XX:XX:XX'
but this gives me error
ifconfig: SIOCSIFHWADDR: Operation not supported
I can see that the mac address is picked from
/sys/class/net/ra0/address
where ra0 is the interface name but its a read only file and is not there on sd card (atleast with the given path)
The mac address of the parent has to be on the sd card but can't find it using grep atleast.
So I would appreciate any help here, either in changing the address on sd card post imaging or override it in system startup.
Thanks
You can take a look on the calibration data in the "art" partition.If your MAC address is stored in it then you can change it.
root#OpenWrt:/# cat /proc/mtd
dev: size erasesize name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00fc0000 00010000 "firmware"
mtd2: 00120000 00010000 "kernel"
mtd3: 00ea0000 00010000 "rootfs"
mtd4: 00c60000 00010000 "rootfs_data"
mtd5: 00010000 00010000 "art"
So my one is /dev/mtd5 . Now I will check the calibration data inside
cat /dev/mtd5 > art.img
hexdump art.img
My wifi MAC address is 04:F0:21:07:7C:EC .After running hexdump art.img it shows
0001000 0202 04f0 2107 7cec 0020 2020 0030 6530
I need to use a software application to modify art.img ,change "04f0 2107 7cec" to new MAC address
Then the final step is :copy the edited art.img to /dev/mtd5
cat art.img > /dev/mtd5
Thanks for the help.
It seems that for mediatek linkit 7688, the MAC is stored in /dev/mtd2. Ideally this is a ROM partition and should not be affected on booting from SD card or raw flash.
But I found that upon boot it caches the same under /lib/firmware/mt7628.eeprom file which also gets copied on preparing sd card from a linkit.
So when I boot second linkit from sd card it considers the first linkit cache as its own /dev/mtd2 cache and thus the problem.
To solve this, after the sd card image is prepared, remove the file /mnt/upper/lib/firmware/mt7628.eeprom and make a symlink to /overlay-boot/upper/lib/firmware/mt7628.eeprom where /mnt is sd card mount location and overlay-boot is raw flash mount location

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?

GSM ACM8060 gives error when using AT cmds in terminal but works with a cell phone

I am using a GSM module ACM8060.
When I try to send SMS using AT commands it returns ERROR but when sms sent from a cell phone using the same SIM it sends successfully.
+CREG: 3
AT+CMGS="nnnnnnnnnn"
ERROR
AT+CREG?
+CREG: 1,3
OK
AT+CMGF=0
OK
AT+CMGF=1
OK
AT+CMGS="nnnnnnnnnn"
> hello [pressed ctrlZ here]
ERROR
where nnnnnnnnnn is a 10 digit mobile phone no.
Which setting in the module could be wrongly set. It was working earlier.
And similar in case of TCP at AT+AIPA=1 it is giving ERROR: 301. Again it works with a cell phone. Which setting to look for?
I suggest turning on verbose error codes using ATV1 so you get more information than simply ERROR. You should then receive an error code like +CME ERROR: xxx or +CMS ERROR: xxx where the xxx will be a detailed error code.

Resources