On Mon, Oct 29, 2018 at 1:18 PM The EMARD <vor...@gmail.com> wrote: > > HI Tim! > > I didn't know about linux-sio-gpio. It seems to support CBUS-only > what is suitable for your hardware :). Please try and let me know > does it work
Davor, linux-sio-gpio also supports FT232R via https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/serial/ftdi_sio.c?id=ff32d97e39e7053fdc1d316bd2e2eff70b77fdd2 This all got merged to Linus' tree as well so it will be present in the 4.20 kernel. > > I don't have hardware that uses only CBUS pins so I can't try it. > One board I have uses mixed cbus and rs232 pins. > I have OpenOCD working now to program the nRF52840 through SWD on FT231X CBUS via sysfsgpio. Here's what I did: 1. build and boot a kernel with the newly added support for sysfs GPIOs for FT-X devices: 'USB: serial: ftdi_sio: implement GPIO support for FT-X devices' - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/serial/ftdi_sio.c?id=ba93cc7da8965bd513a7393db0f030e51bff4b60 2. use the ftdi_eeprom tool from libftdi to program the FT231X EEPROM to change the cbus signals I'm using from their default function to generic IO's: see https://github.com/mozilla-sensorweb/sensorweb-wiki/wiki/Flashing-the-FTDI-EEPROM-under-linux. My conf file has 'cbusx1=IOMODE' and 'cbusx2=IOMODE' in it 3. use git master of openocd as it has support in it for nRF52840 which the latest openocd release doesn't yet have and program with the following: # find the base GPIO for the ftdi-cbus gpio controller base=$(for i in $(ls -1d /sys/class/gpio/gpiochip*); do [ "ftdi-cbus" = "$(cat $i/label)" ] && cat $i/base; done) [ "$base" ] || { echo "Error: could not find ftdi-cbus device"; } # create a conf file that maps cbus1 to swdio and cbus2 to swdclk cat << EOF > gw16126.cfg interface sysfsgpio transport select swd # set: swclk swdio sysfsgpio_swd_nums $((base + 2)) $((base + 1)) EOF # program nRF52 export FIRMWARE=zephyr_hciuart.hex export OPENOCD=/root/openocd $OPENOCD/src/openocd -s $OPENOCD/tcl -f gw16126.cfg -f target/nrf52.cfg -c init -c "reset init" -c halt -c "nrf5 mass_erase" -c "program $FIRMWARE verify" -c reset -c exit I'm still interested in cbus gpio support in the ft232r driver however as it removes the kernel dependency of needing the latest ftdi-sio driver with gpio support so I may hack around with it later - let me know if you do so as well. Thanks for your help! Regards, Tim _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel