Changes between Version 19 and Version 20 of cc135x


Ignore:
Timestamp:
08/12/2020 11:55:49 PM (4 years ago)
Author:
Cale Collins
Comment:

added note about connecting antenna, added note about rmmod ftdi_sio before programming, added section for DTR.

Legend:

Unmodified
Added
Removed
Modified
  • cc135x

    v19 v20  
    3333 - TI Launchpad
    3434  * These have an XDS110 JTAG Debugger on-board (implemented via the Tiva MCU chip). The XDS110 debugger exposes two USB ACM serial devices where the first one is tied directly to the CC13xx UART (pinout matching the 'serial downloader' pins specified in the TRM) and the second serial device is for JTAG programming. These boards can be programmed via the TI 'Uniflash' tool (GUI or stand-alone command-line) or the CCS IDE.
     35
     36** IMPORTANT **  Always have an antenna connected, without one the high power amplifier will glitch the board and cause a reset.
    3537
    3638References:
     
    404406 * GW5910-C via IMX6 GPIO
    405407
     408Before attempting to use the Gateworks Jtag programmer {{{sudo rmmod ftdi_sio}}}, without this step programming may fail. 
     409
    406410Note that the OpenOCD package from Ubuntu lacks the necessary cc26xx flash driver so we must either build OpenOCD from source manually or use the Gateworks Ubuntu PPA:
    407411 * Installing from Gateworks Ubuntu PPA:
     
    611615  - make sure you point to the correct /dev/ttyUSB* device managed by the ftdi_sio driver
    612616
     617== DTR
     618
     619Some board revisions will reqire DTR to be asserted before the board will come out of reset.  DTR is part of a UART policy dating back to the modem days where by default 'HUP' is enabled which will send a 'hangup' signal (via DTR or data-terminal-ready) when the last process closes the tty. In essence DTR# is driven high when no processes have the UART device open and driven low when any process has the UART device open. Unfortunately this is the wrong polarity to 'just work' in an obvious manner.
     620
     621You can manually control DTR in a number of ways:
     622 * use {{{picocom}}} ([#picocom see below]) which allows you to toggle DTR via control commands
     623 * use {{{stty}}} to disable HUP which will release DTR# and drive it high letting the CC1352P out of reset but not that terminal programs may put it back in reset if they control DTR.
     624{{{#!bash
     625# Find the tty associated with the GW16122 device in your system
     626TTY=/dev/$(for i in $(ls -1d /sys/bus/usb/devices/*); do [ -r $i/interface ] && { [[ "$(cat $i/interface)" =~ "GW16122" ]] && basename $(ls -d $i/ttyUSB*); }; done)
     627echo $TTY
     628stty -F $TTY hup
     629}}}
     630 * write your own UART code that uses the TIOCMBIS and TIOSMBIS ioctl to manually control the modem signals:
     631  - with a C application use an ioctl on the tty from termios.h:
     632{{{#!c
     633cat << EOF > dtr.c
     634#include <errno.h>
     635#include <fcntl.h>
     636#include <stdio.h>
     637#include <stdlib.h>
     638#include <unistd.h>
     639
     640#include <sys/ioctl.h>
     641#include <sys/types.h>
     642#include <sys/stat.h>
     643
     644int main(int argc, char **argv)
     645{
     646        int fd, line, assert;
     647        const char *tty;
     648
     649        if (argc < 2) {
     650                fprintf(stderr, "usage: %s <ttydev> <0|1>\n", argv[0]);
     651                exit -1;
     652        }
     653
     654        tty = argv[1];
     655        assert = atoi(argv[2]);
     656
     657        /* open serial port */
     658        fd = open(tty, O_RDWR | O_NOCTTY);
     659        if (fd == -1) {
     660                perror("open");
     661                exit -errno;
     662        }
     663
     664        /* perform IOCTL to set DTR */
     665        line = TIOCM_DTR;
     666        printf("%s: %s DTR#\n", tty, assert ? "assert" : "deassert");
     667        if (ioctl(fd, assert ? TIOCMBIS : TIOCMBIC, &line) == -1) {
     668                perror("ioctl");
     669                close(fd);
     670                exit (-errno);
     671        }
     672        close(fd);
     673
     674        return 0;
     675}
     676EOF
     677}}}
     678{{{#!bash
     679gcc -c dtr.c -o dtr
     680chmod +x dtr
     681# Find the tty associated with the GW16122 device in your system
     682TTY=/dev/$(for i in $(ls -1d /sys/bus/usb/devices/*); do [ -r $i/interface ] && { [[ "$(cat $i/interface)" =~ "GW16122" ]] && basename $(ls -d $i/ttyUSB*); }; done)
     683echo $TTY
     684# make sure a HUP will not be sent when a process does not have control over the TTY
     685stty -F $TTY -hup
     686# assert DTR# (drive low; hold part in reset)
     687./dtr $TTY 1
     688# deassert DTR# (drive high; release part from reset)
     689./dtr $TTY 0
     690}}}
     691  - use python-serial via a python script:
     692{{{#!python
     693cat << EOF > dtr
     694#!/usr/bin/env python
     695
     696import serial
     697import string
     698import sys
     699
     700if len(sys.argv) < 3:
     701    print("usage: %s <ttydev> <0|1>\n" % sys.argv[0])
     702    exit(-1)
     703
     704dev=sys.argv[1]
     705lvl=string.atoi(sys.argv[2])
     706
     707if lvl:
     708    print("%s: assert DTR#\n" % dev)
     709else:
     710    print("%s: deassert DTR#\n" % dev)
     711ser = serial.Serial(dev)
     712ser.isOpen()
     713ser.setDTR(lvl)
     714ser.close()
     715EOF
     716}}}
     717{{{#!bash
     718apt install python python-serial
     719chmod +x dtr
     720# Find the tty associated with the GW16122 device in your system
     721TTY=/dev/$(for i in $(ls -1d /sys/bus/usb/devices/*); do [ -r $i/interface ] && { [[ "$(cat $i/interface)" =~ "GW16122" ]] && basename $(ls -d $i/ttyUSB*); }; done)
     722echo $TTY
     723# make sure a HUP will not be sent when a process does not have control over the TTY
     724stty -F $TTY -hup
     725# assert DTR# (drive low; hold part in reset)
     726./dtr $TTY 1
     727# deassert DTR# (drive high; release part from reset)
     728./dtr $TTY 0
     729}}}
     730
    613731
    614732