This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Unable to Program LAUNCHXL-F28377S - Error -2131 @ 0x0

Other Parts Discussed in Thread: ENERGIA, CONTROLSUITE, UNIFLASH, TMS320F28377S

After receiving a LAUNCHXL-F28377S I was able to successfully program it through Energia using some examples and a few scripts of my own.  However, after programming the attached code (Initialization_Test.txt, an LCD initialization and testing program) which does not run correctly, I am no longer able to program the device with any code via Energia or CCSv6.  When downloading the attached code, remember to change the file extension back to .ino (the forum will not let me upload a .ino filetype).  When programming via Energia, I receive the following error (bolded):

Failed: Operation was aborted
Initializing Register Database...
Initializing: IcePick_C_0
Executing Startup Scripts: IcePick_C_0
Initializing: C28xx_CPU1
Executing Startup Scripts: C28xx_CPU1
Connecting...
fatal: IcePick_C_0: Error connecting to the target: (Error -2131 @ 0x0) Unable to access device register. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 6.0.14.5)

When programming via CCS, I receive a similar error (bolded):

Error connecting to the target:
(Error -2131 @ 0x0)
Unable to access device register. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK).
(Emulation package 6.0.83.1)


I followed the error code's recommendation to reset the device and attempt to reprogram (I pressed the only button on the board and pulled the jumper and reconnected it), but the programmers returned the same error.

I have followed other various E2E suggestions, such as reinstalling the FTDI drivers, programming some examples through controlSUITE, running FTClean to "clean" the FTDI drivers, attempting to erase the F28377S's flash memory via UniFlash, though each to no avail returning the same error as CCS (when actually attempting to program the device).

I have cycled through all boot modes controlled by the on-board switches, and no luck with any orientation.

In CCSv6 I ran the "Test Connection" routine in the TMS320F28377S.ccxml file which returned the following failures (bolded):

[Start: Texas Instruments XDS100v2 USB Debug Probe]

Execute the command:

%ccs_base%/common/uscif/dbgjtag -f %boarddatafile% -rv -o -F inform,logfile=yes -S pathlength -S integrity

[Result]


-----[Print the board config pathname(s)]------------------------------------

C:\Users\Sam\AppData\Local\TEXASI~1\CCS\
ti\0\0\BrdDat\testBoard.dat

-----[Print the reset-command software log-file]-----------------------------

This utility has selected a 100- or 510-class product.
This utility will load the adapter 'jioserdesusb.dll'.
The library build date was 'Dec 9 2015'.
The library build time was '20:05:50'.
The library package version is '6.0.83.1'.
The library component version is '35.35.0.0'.
The controller does not use a programmable FPGA.
The controller has a version number of '4' (0x00000004).
The controller has an insertion length of '0' (0x00000000).
This utility will attempt to reset the controller.
This utility has successfully reset the controller.

-----[Print the reset-command hardware log-file]-----------------------------

The scan-path will be reset by toggling the JTAG TRST signal.
The controller is the FTDI FT2232 with USB interface.
The link from controller to target is direct (without cable).
The software is configured for FTDI FT2232 features.
The controller cannot monitor the value on the EMU[0] pin.
The controller cannot monitor the value on the EMU[1] pin.
The controller cannot control the timing on output pins.
The controller cannot control the timing on input pins.
The scan-path link-delay has been set to exactly '0' (0x0000).

-----[The log-file for the JTAG TCLK output generated from the PLL]----------

There is no hardware for programming the JTAG TCLK frequency.

-----[Measure the source and frequency of the final JTAG TCLKR input]--------

There is no hardware for measuring the JTAG TCLK frequency.

-----[Perform the standard path-length test on the JTAG IR and DR]-----------

This path-length test uses blocks of 64 32-bit words.

The test for the JTAG IR instruction path-length failed.
The JTAG IR instruction scan-path is stuck-at-ones.

The test for the JTAG DR bypass path-length failed.
The JTAG DR bypass scan-path is stuck-at-ones.

-----[Perform the Integrity scan-test on the JTAG IR]------------------------

This test will use blocks of 64 32-bit words.
This test will be applied just once.

Do a test using 0xFFFFFFFF.
Scan tests: 1, skipped: 0, failed: 0
Do a test using 0x00000000.
Test 2 Word 0: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 1: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 2: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 3: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 4: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 5: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 6: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 7: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
The details of the first 8 errors have been provided.
The utility will now report only the count of failed tests.
Scan tests: 2, skipped: 0, failed: 1
Do a test using 0xFE03E0E2.
Scan tests: 3, skipped: 0, failed: 2
Do a test using 0x01FC1F1D.
Scan tests: 4, skipped: 0, failed: 3
Do a test using 0x5533CCAA.
Scan tests: 5, skipped: 0, failed: 4
Do a test using 0xAACC3355.
Scan tests: 6, skipped: 0, failed: 5
Some of the values were corrupted - 83.3 percent.

The JTAG IR Integrity scan-test has failed.

-----[Perform the Integrity scan-test on the JTAG DR]------------------------

This test will use blocks of 64 32-bit words.
This test will be applied just once.

Do a test using 0xFFFFFFFF.
Scan tests: 1, skipped: 0, failed: 0
Do a test using 0x00000000.
Test 2 Word 0: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 1: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 2: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 3: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 4: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 5: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 6: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
Test 2 Word 7: scanned out 0x00000000 and scanned in 0xFFFFFFFF.
The details of the first 8 errors have been provided.
The utility will now report only the count of failed tests.
Scan tests: 2, skipped: 0, failed: 1
Do a test using 0xFE03E0E2.
Scan tests: 3, skipped: 0, failed: 2
Do a test using 0x01FC1F1D.
Scan tests: 4, skipped: 0, failed: 3
Do a test using 0x5533CCAA.
Scan tests: 5, skipped: 0, failed: 4
Do a test using 0xAACC3355.
Scan tests: 6, skipped: 0, failed: 5
Some of the values were corrupted - 83.3 percent.

The JTAG DR Integrity scan-test has failed.

[End: Texas Instruments XDS100v2 USB Debug Probe]

The only LEDs lit while the Launchpad is plugged in via USB in its current state are LEDs D1 and D4.  Both LEDs are lit green.

Are there any suggestions for how to fix this programming issue?  Is there any other information I can provide to help debug?

Thank you in advance!

#define D7    P17
#define D6    P16
#define D5    P15
#define D4    P14
#define D3    P13
#define D2    P12
#define D1    P11
#define D0    P10
#define D_C   P2
#define nWR   P3
#define nRES  P4
#define LED   RED_LED

void setup() {
  int i = 0;
  
  pinMode(LED, OUTPUT);  
  pinMode(D_C, OUTPUT);
  pinMode(nWR, OUTPUT);
  pinMode(nRES, OUTPUT);
  pinMode(D7, OUTPUT);
  pinMode(D6, OUTPUT);
  pinMode(D5, OUTPUT);
  pinMode(D4, OUTPUT);
  pinMode(D3, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D1, OUTPUT);
  pinMode(D0, OUTPUT);
  
  delay(5000);
  
  Serial.print("here1");
  
  initLCD();
  
//  commOut(0x2A);
//  dataOut(0x00);
//  dataOut(0x0A);
//  dataOut(0x00);
//  dataOut(0x13);
//  
//  commOut(0x2B);
//  dataOut(0x00);
//  dataOut(0x0A);
//  dataOut(0x00);
//  dataOut(0x13);

  commOut(0x2C);
  
//  for (n = 0; n < 3; n++) {
    for (i = 0; i < 76800; i++) {
      dataOut(0xFF);
      dataOut(0xFF);
      dataOut(0);
    }
//  }
  
//  for(i = 0; i < 100; i++) {
//    dataOut(0x07);
//    dataOut(0xE0);
//  }
}

void loop() {
  digitalWrite(LED, LOW);
  delay(1000);
  digitalWrite(LED, HIGH);
  delay(1000);
//  digitalWrite(nRES, LOW);
//  disp();
//  delay(1000);
}

//void disp() {
//	unsigned int i; 
//	commOut(0x2C);              //command to begin writing to frame memory
//	for(i=0;i<38400;i++)         //fill screen with blue pixels
//	{
//	    dataOut(0x00);
//            dataOut(0x1F);
//            dataOut(0x00);
//            dataOut(0x1F);
//	}
//        for(i=0;i<38400;i++)         //fill screen with green pixels
//	{
//	    dataOut(0x07);
//            dataOut(0xE0);
//            dataOut(0x07);
//            dataOut(0xE0);
//        }
//}

//void TFT_delay(unsigned int x) {
//  unsigned int i;
//  for (i = 0; i< x; i++) {
//    asm("          NOP");
//    asm("          NOP");
//    asm("          NOP");
//    asm("          NOP");
//    asm("          NOP");
//    asm("          NOP");
//    asm("          NOP");
//    asm("          NOP");
//    asm("          NOP");
//    asm("          NOP");
//  }
//}

void initLCD(void) {
//  GPIO_ResetBits(GPIOC, CS1);  //Not needed since LCD select will be hard-true
//  GPIO_SetBits(GPIOC, nRD);    //Not needed since nRD will be hard-false
  digitalWrite(nWR, LOW);
  digitalWrite(nRES, LOW);
  delayMicroseconds(11);
//  TFT_delay(1);
  digitalWrite(nRES, HIGH);
  delay(5);
//  TFT_delay(1);
  commOut(0x0011);//exit SLEEP mode
  Serial.print("here2");
  delayMicroseconds(1);
  
  commOut(0x0036);
  dataOut(0x0080);//MADCTL: memory data access control
  commOut(0x003A);
  dataOut(0x0066);//COLMOD: Interface Pixel format
  commOut(0x00B2);
  dataOut(0x000C);
  dataOut(0x0C);
  dataOut(0x00);
  dataOut(0x33);
  dataOut(0x33);//PORCTRK: Porch setting
  commOut(0x00B7);
  dataOut(0x0035);//GCTRL: Gate Control
  commOut(0x00BB);
  dataOut(0x002B);//VCOMS: VCOM setting
  commOut(0x00C0);
  dataOut(0x002C);//LCMCTRL: LCM Control
  commOut(0x00C2);
  dataOut(0x0001);
  dataOut(0xFF);//VDVVRHEN: VDV and VRH Command Enable
  commOut(0x00C3);
  dataOut(0x0011);//VRHS: VRH Set
  commOut(0x00C4);
  dataOut(0x0020);//VDVS: VDV Set
  commOut(0x00C6);
  dataOut(0x000F);//FRCTRL2: Frame Rate control in normal mode
  commOut(0x00D0);
  dataOut(0x00A4);
  dataOut(0xA1);//PWCTRL1: Power Control 1
  commOut(0x00E0);
  dataOut(0x00D0);
  dataOut(0x0000);
  dataOut(0x0005);
  dataOut(0x000E);
  dataOut(0x0015);
  dataOut(0x000D);
  dataOut(0x0037);
  dataOut(0x0043);
  dataOut(0x0047);
  dataOut(0x0009);
  dataOut(0x0015);
  dataOut(0x0012);
  dataOut(0x0016);
  dataOut(0x0019);//PVGAMCTRL: Positive Voltage Gamma control
  commOut(0x00E1);
  dataOut(0x00D0);
  dataOut(0x0000);
  dataOut(0x0005);
  dataOut(0x000D);
  dataOut(0x000C);
  dataOut(0x0006);
  dataOut(0x002D);
  dataOut(0x0044);
  dataOut(0x0040);
  dataOut(0x000E);
  dataOut(0x001C);
  dataOut(0x0018);
  dataOut(0x0016);
  dataOut(0x0019);//NVGAMCTRL: Negative Voltage Gamma control
  commOut(0x002A);
  dataOut(0x0000);
  dataOut(0x0000);
  dataOut(0x0000);
  dataOut(0x00EF);//X address set
  commOut(0x002B);
  dataOut(0x0000);
  dataOut(0x0000);
  dataOut(0x0001);
  dataOut(0x003F);//Y address set
  delayMicroseconds(1);
  commOut(0x29);
}

void commOut(unsigned int command) {
  digitalWrite(D_C, LOW);
//  GPIO_ResetBits(GPIOC, CS1);  //Not needed since LCD select will be hard-true
//  digitalWrite(nRES, LOW);
//  GPIO_SetBits(GPIOC, nRD);    //Not needed since nRD will be hard-false
  digitalWrite(nWR, LOW);
  gpioWrite(command);
//  asm("          NOP");
//  asm("          NOP");
//  asm("          NOP");
  digitalWrite(nWR, HIGH);
//  asm("          NOP");
//  asm("          NOP");
//  asm("          NOP");
//  asm("          NOP");
}

void dataOut(unsigned int data1) {
//  digitalWrite(D_C, HIGH);
  gpioWrite(data1);
  digitalWrite(D_C, HIGH);
  digitalWrite(nWR, LOW);
//  asm("          NOP");
//  asm("          NOP");
//  asm("          NOP");
//  asm("          NOP");
  digitalWrite(nWR, HIGH);
//  asm("          NOP");
//  asm("          NOP");
//  asm("          NOP");
//  asm("          NOP");
}

void gpioWrite(unsigned long val) {
  GpioDataRegs.GPADAT.all &= 0xFFFC03FF;
//  asm("          NOP");
//  asm("          NOP");
//  asm("          NOP");
//  asm("          NOP");
  GpioDataRegs.GPADAT.all |= val << 10;
}