Novena as JTAG adapter

You can use your Novena as a JTAG adapter so that you can debug other JTAG capable devices.

For this your Novena needs to be updated to a current kernel (>=4.4) (to update use "apt-get dist-upgrade").

For reference, this is the mapping of "extra" pins on Novena internal serial headers to GPIO pin numbers which are used for JTAG. The layout is like this:

|-- |  | d  u  | e  a  | b  r  | u  t  | g  4  <- pin 1/GND | | u  | a  | r  | t  | 3     <- pin 1/GND |

If you want to be able to use the additional TRST and/or SRST lines, you need to change the pinmapping of those pins. Unfortunately this cannot be done through the userspace yet, so you have to change the device-tree file for the Linux kernel.

I have a provided a ready-made device-tree file for you: http://www2.futureware.at/~philipp/ssd/novena.dtb Download this file and replace the one you have on the Novena boot partition with this file.

If you want to compile it yourself, you have to get the Novena Linux sources https://www.kosagi.com/w/index.php?title=Novena_linux-kernel Then you have to change the following 2 lines in the file novena-linux/arch/arm/boot/dts/imx6q-novena.dts:

--- imx6q-novena.dts.orig      2016-08-16 18:33:45.031569966 +0200 +++ imx6q-novena.dts   2016-08-16 18:34:56.167303763 +0200 @@ -850,8 +850,8 @@       uart3 { pinctrl_uart3_novena: uart3grp-novena { fsl,pins = < -                              MX6QDL_PAD_EIM_D24__UART3_TX_DATA 0x1b0b1 -                              MX6QDL_PAD_EIM_D25__UART3_RX_DATA 0x1b0b1 +                              MX6QDL_PAD_EIM_D24__GPIO3_IO24 0x1b0b1 +                              MX6QDL_PAD_EIM_D25__GPIO3_IO25 0x1b0b1 >;               };        };

After the change you can compile it with "make dtbs" which generates the novena.dtb, which you can deploy on the boot partition then.

As JTAG software you need OpenOCD. Unfortunately the openocd version that comes with Debian Jessie is not compiled with sysfsgpio support, so you have to get the sources from openocd.org and compile openocd yourself with "./configure -–enable-sysfsgpio ; make ; make install"

To use openocd you need the following configuration file:

openocd configuration: interface sysfsgpio transport select jtag sysfsgpio_jtag_nums 163 16 162 20 sysfsgpio_srst_num 88 sysfsgpio_trst_num 89
 * 1) Each of the JTAG lines need a gpio number set: tck(163) tms(16) tdi(162) tdo(20)

Run it like "openocd -f novena.cfg"

Unit-Tests

1. GND Test

Before you connect the Novena has JTAG adapter with the target board, measure the voltage between the 2 GND(ground) pins of the Novena and the target board with a multimeter. Ideally the voltage should be 0V.

2. GPIO Testing

Run the following toggle script with the pin-number as parameter: ./toggle.sh 162 ./toggle.sh 20

It sets the direction of the GPIO to output and toggles the specified GPIO on and off every second, which you can measure with the Multimeter.

If you do not get a 0V / 3.3 V toggling signal on the Pin:
 * Make sure you measured at the right pin
 * Update your kernel to the latest 4.4 version or newer
 * Make sure that the device-tree (novena.dtb) is correctly configured regarding pin-muxing (PINCTRL), you can verify that in /sys/class/... but unfortunately you cannot control it from userspace at the moment. If you want to change that you either need device-tree overlays or you have to generate a new novena.dtb file.