tip hardwire returns fcntl: Invalid argument - serial-port

I am trying to connect via serial line from a FreeBSD box to a Sun Fire V210 running Solaris 8.
I have a serial line connected from the FreeBSD serial port to the Sun Serial Management port.
On the FreeBSD box (observer) I have this in /etc/remote:
hardwire:\
:dv=/dev/usb0:br#9600:el=^C^S^Q^U^D:ie=%$:oe=^D:
When I do tip hardwire I get:
# tip hardwire
fcntl: Invalid argument
One note: There was a power outage that caused the FreeBSD box to be rebooted.
Before the power outage, tip hardwire worked fine.
I do not see any files in /var/spool/lock/
Any help?

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.

Unable to remote debug gdbserver over serial port

I'm trying to remote debug using gdbserver.
I connect my target device to my PC through USB port using this command to open terminal controlling my device :
minicom -D "/dev/ttyUSB0".
Now on my target device, I need to run gdbserver with this cmd:
gdbserver /dev/my_USB_serial_port my_Program.
However, I can't find ttyUSB0, all I got ís a bunch of ttyx(with x is a number) as below:
~ # /dev/tty
tty tty14 tty20 tty27 tty33 tty4 tty46 tty52 tty59 tty8
tty0 tty15 tty21 tty28 tty34 tty40 tty47 tty53 tty6 tty9
tty1 tty16 tty22 tty29 tty35 tty41 tty48 tty54 tty60 ttyS0
tty10 tty17 tty23 tty3 tty36 tty42 tty49 tty55 tty61 ttyS1
tty11 tty18 tty24 tty30 tty37 tty43 tty5 tty56 tty62
tty12 tty19 tty25 tty31 tty38 tty44 tty50 tty57 tty63
tty13 tty2 tty26 tty32 tty39 tty45 tty51 tty58 tty7
How could I find which one is the correct serial port of my USB port ?
Update 1: As Employed Russian mentioned in the answer, I got confused about the USB port but I still couldn't connect to gdbserver using his command.
However, I can't find ttyUSB0
You are confused -- of course you will not find ttyUSB0 on the target -- the target doesn't have anything plugged into its USB port.
On the target, you want to run gdbserver - my_Program &, then disconnect minicom, and finally use gdb and target remote /dev/ttyUSB0 on the host.
Make sure getty isn't running on the same serial port as gdbserver on the target.
If you've got an interactive shell with minicom, check the serial port (usually ttyS0) on the target that's connected to it. If it's ttyS0, you start gdbserver on some other port, and connect another FTDI cable from that port to a second USB port on your host.

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

Asterisk WARNING[4695]: chan_dahdi.c:12320 do_monitor: Read failed with -1: Invalid argument

when I restart Asterisk and connect to the Asterisk console with a
asterisk -rv
Asterisk is spitting thousands of
WARNING[4695]: chan_dahdi.c:12320 do_monitor: Read failed with -1: Invalid argument
after some minutes of this crazy spitting of messages it quits with a
*CLI>
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups
a dmesg shows:
[ 3561.591539] asterisk[4695]: segfault at b3150fec ip b73a4b8d sp b3150ff0 error 6 in libc-2.19.so[b7334000+1a8000]
I have no idea how to deal with this and find no similar error anywhere.
I am using a Digium TDM410P telephony card with 2 FXO and two FXS interfaces.
Dahdi linux driver < 2.10.0.1 is incompatible with linux kernel 3.16+
See complete problem description and fix in Asterisk Jira:
https://issues.asterisk.org/jira/browse/DAHLIN-340

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