I used LM3s811 EVAL Board and configed GPIO pin3 (1 of 4 JTAG pin) like a normal GPIO pin and write '1' value to this pin, so I get some problem: "Please power cycle the board and try again".
Somebody can help me fix it?
Many thanks!
You've "broken" the normal JTAG connection array by re-configuring PC_3. MCU datasheet advises (more than once) that PC_0 - PC_3 are JTAG - should not be used otherwise!
Most Stellaris enable a utility w/in LMI Flash Programmer to "restore" JTAG - but unfortunately your part is "Sandstorm" class - and not included.
If you reconfigured PC_3 deep enough w/in your code - you may be able to "force" the program to halt - and then attach debugger and remove the PC_3 offending code. (search this forum - I advised TI client in just this manner - and it worked!) Each case is unique though - prescribe more datasheet reading - less action - in your case...
Many thanks to you!
It is my mistake, I want to use PC4 but I typed wrong. Then I didn't check before use!
James MilerI want to use PC4 but I typed wrong.
Ouch! That is unfortunate...
Again - depending upon "where" in your code this misfortune occurred - you may be able to "force" the MCU to halt - and then switch in the debugger to remove this errant code.
There's one other possibility - although its very messy. You have not lost SWD program/debug capability. (appears upon PC_0 & PC_1.) Should you have an SWD/JTAG probe - and if you can "break" the existing connections from MCU PC_0 - PC_3 - to the FTDI chip on the 3S811 board - you can likely use SWD for debug & programming. (of course you must "bring out" PC_0 & PC_1 for attachment to your SWD/JTAG probe for this to work)
Our firm places warning cards about PC_0 - PC_3 at each workstation - any use of Port C should be double/triple checked when using Sandstorm... Good luck...
I paste my code below. I've readed this topic http://e2e.ti.com/support/microcontrollers/stellaris_arm_cortex-m3_microcontroller/f/471/p/127677/458597.aspx#458597, but my line Display96x16x1Init(false) below wrong code line.
intmain(void){ uint8_t data; uint8_t i; unsigned long result; // // Set the clocking to run directly from the crystal. // SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ); // // Enable the peripherals used by this application. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI); // Configure the push button as an input and enable the pin to interrupt on // the falling edge (i.e. when the push button is pressed). // GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_4); GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3); GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_5); GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_6); GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_3); GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2); SSIConfigSetExpClk(SSI_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8); GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,0); SSIEnable(SSI_BASE); // // Set the global and local indicator of pin mode to zero, meaning JTAG. // // // Initialize the OLED display. // Display96x16x1Init(false); Display96x16x1StringDraw("Hello", 0, 0); SysCtlDelay(SysCtlClockGet()/3); //initMRF24J40(); //enterSendMode(); SSIDataPut(SSI_BASE, 0x99); SSIDataPut(SSI_BASE, 0x33); while(SSIBusy(SSI0_BASE)) { } SSIDataGet(SSI_BASE, &result); Display96x16x1StringDraw(tem, 1, 1); for (i = 0x00; i <= 0x3F; i++) { data = getShortRAMAddr(i<<1); snprintf(tem, sizeof(tem), "%d", i); Display96x16x1StringDraw(tem, 0, 0); tem[0]='\0'; snprintf(tem, sizeof(tem), "%d", data); Display96x16x1StringDraw(tem, 0, 1); tem[0]='\0'; SysCtlDelay(SysCtlClockGet()/3); Display96x16x1Clear(); } */ // // Loop forever. This loop simply exists to display on the OLED display // the current state of PB7/PC0-3; the handling of changing the JTAG pins // to and from GPIO mode is done in GPIOCIntHandler(). // while(1) { }}
James MilerGPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_6); GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_3);
As you realize - red highlight is the instruction which, "does you in." Just maybe - if we're extremely lucky - instruction just before (which places PC_6 as input) can trigger an interrupt "before" PC_3 instruction executes. (your code shown does not reveal - or I've missed it.) This "may" enable enough time for your debugger to establish contact - although I would not, "hold my breath."
Should you - or friends/firms nearby have automated equipment - simplest & cleanest fix is to remove that MCU and replace.
Our misfortune is that the re-purposing of PC_3 happens quite early in your code - may not be time (or a proper means) for the debugger to gain control. (your MCU actually reverts to JTAG from power-up/reset - only switches PC_3 upon reaching the highlighted instruction - this is what we seek to prevent)
If you/friends do not have proper equipment - and you have a "real" JTAG/SWD Probe - my earlier suggestion about SWD should work. (our firm uses SWD: PC_0 & PC_1 almost exclusively - gaining 2 GPIO in the process) But you must "open" tracks joining your MCU to the FTDI chip - and then create a lead extension for PC_0 & PC_1 - not for the faint of heart...
I fixed it. I don't know how to say thank you.
Thanks is always nice - and you've shown that repeatedly!
More importantly - for unfortunate others (sometime in the future) - kindly explain w/some detail, "just how" you achieved the "fix."
I suffered the same fate - back in 2007 - and was saved by, "Stellaris Dan" - who taught me this method.
There is a better way yet - which should be mandatory for ALL Sandstorm Class (i.e. LM3S1xx, LM3S3xx, LM3S6xx, and LM3S8xx) users! Find, study and employ the file, "gpio-jtag.c" which provides a SW safety mechanism which can restore JTAG without use of the LMI Flash Programmer. (Flash Programmer signals "no support" for Sandstorm) You are to place this "gpio-jtag.c" defensive/safety code at the top of your program - this enables JTAG to be quickly/easily restored should a Port_C "mistake" occur.
This method works well for newer class devices too - far faster/easier/less stressful to, "recover JTAG" via a single GPIO - or Timer - or xxx - than to have to run the Flash Unlock Utility...