hi i am working on MSP430F5438 if (bufferSize > 0) { //halLcdPrint(halUsbReceiveBuffer,OVERWRITE_TEXT); halLcdCursor(); for(j=0;j < bufferSize;j++) { audioReceiveBuffer[j] = halUsbReceiveBuffer[j]; //i++; }
-------------------------------------------------------------------------------------------------------------------------------------------------
void flash_audio_record(){ int k = 0; int count = 4; unsigned char temp[4]; unsigned long int data_32;
memstart = 0X30000; memend = 0X31000; //flashEraseBank(MEM_START[0]); // flashEraseBank(MEM_START[1]);
FCTL3 = FWKEY; FCTL1 = FWKEY + BLKWRT; // Flash UNLOCK halLcdPrintLine("Recording..", 6, INVERT_TEXT | OVERWRITE_TEXT); //halLcdClearScreen(); //while(audioReceiveBuffer[j]!= '\0')
while(memstart != 0x30999) { temp[k] = audioReceiveBuffer[j]; //memstart = audioReceiveBuffer[j]; k++; j++; if( j == count ) { halLcdPrintLineCol((char*)temp,2,1,OVERWRITE_TEXT); LED_PORT_OUT |= LED_1; data_32 = temp[3]; data_32 = data_32 >> 8; data_32 |= temp[2]; data_32 = data_32 >> 8; data_32 |= temp[1]; data_32 = data_32 >> 8; data_32 = temp[0]; memstart = data_32; //4 bytes are loaded over flash memory location memstart++; count = count + 4; LED_PORT_OUT &= ~LED_1; } } lastaudiobyte = memstart;
FCTL3 = FWKEY + LOCK; //Flash LOCK halLcdPrintLineCol("DONE", 6, 1, OVERWRITE_TEXT); halLcdPrintLineCol(" Stop ", 8, 1, OVERWRITE_TEXT);}
why it is reseting the msp board m not getting problem pls help me out
Where's you rmain code? Do you disable the watchdog timer? It will reset the MSP after 32ms otherwise (e.g. during the erase operation).Did you disable interrupts? Durign a flash write operation, interrupts msu tbe disabled or else the MSP will fetch teh 'busy' return value as interrupt vector address from the busy flash controller and then jump into the void.
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.
/******************************************************************************* Filename: usbTest.c
Copyright 2008 Texas Instruments, Inc.*******************************************************************************/
extern char halUsbReceiveBuffer[];extern unsigned char bufferSize;extern unsigned char audioReceiveBuffer[255];extern void flash_audio_record();extern void flash_audio_playback();
extern void playback();
void usbTest(){ unsigned char quit=0,i=0 ,j=0;
halButtonsInterruptEnable( BUTTON_ALL ); halUsbInit(); halLcdClearScreen(); halLcdPrintLine("baudrate = 57600", 0, 0); halLcdPrintLine("Press R Buttons", 1, 0);
while (quit == 0) { buttonsPressed = 0; __bis_SR_register(LPM3_bits + GIE); if (buttonsPressed & BUTTON_UP) halUsbSendChar('U');
if (buttonsPressed & BUTTON_DOWN) halUsbSendChar('D');
if (buttonsPressed & BUTTON_LEFT){ halLcdPrintLine("playback", 2, 0); flash_audio_playback();}
if (buttonsPressed & BUTTON_RIGHT) { halLcdPrintLine("record", 2, 0); flash_audio_record(); } if (buttonsPressed & BUTTON_SELECT) { halUsbSendChar('Q'); halLcdClearScreen(); quit =1 ; }
if (bufferSize > 0) { //halLcdPrint(halUsbReceiveBuffer,OVERWRITE_TEXT); halLcdCursor(); for(j=0;j < bufferSize;j++) { audioReceiveBuffer[j] = halUsbReceiveBuffer[j]; //i++; } // audioReceiveBuffer[bufferSize] = '\0'; //halLcdPrint((char*)audioReceiveBuffer,OVERWRITE_TEXT); for (i = 0; i < bufferSize; i++) halUsbReceiveBuffer[i] = '\0'; bufferSize = 0; } }
halUsbShutDown(); halLcdCursorOff();}
/******************************************************************************* Filename: audio_playback.c
*******************************************************************************/
static unsigned long MEM_START[] = {0x30000, 0x40000};unsigned long memstart;unsigned long memend;unsigned long lastaudiobyte;unsigned char audioReceiveBuffer[255];
unsigned char data;unsigned long PlaybackPtr;static int j = 0;
void flash_audio_record();void flash_audio_playback();
void flash_audio_playback(){ // Power-up external hardware AUDIO_PORT_DIR |= AUDIO_OUT_PWR_PIN; AUDIO_PORT_OUT &= ~AUDIO_OUT_PWR_PIN; AUDIO_OUT_SEL |= AUDIO_OUT_PIN; // P4.4 = TB4 LED_PORT_OUT |= LED_2; halLcdPrintLine(" playing ", 6, INVERT_TEXT | OVERWRITE_TEXT); PlaybackPtr = (unsigned long)(memstart); PlaybackPtr ++; // Setup Timer0_A for playback TBCTL = TBSSEL_2 + TBIE; // Use SMCLK as Timer0_A source, // Enable overflow interrupt TBCCR0 = 255; // Set output resolution (8 bit) //output time : 15.9 microsecond (255*62.5 nanosecond)(15.9*8 = 127 microsecond) // Add 10 counts of headroom for // loading TBCCR1 TBCCR4 = 255 >> 1; // Default output ~Vcc/2 TBCCTL4 = OUTMOD_7 + CLLD_1; // Reset OUT1 on EQU1, set on EQU0 // Load TBCCR1 when TBR counts to 0 TBCTL |= MC0; // Start Timer_B in UP mode // (counts up to TBCCR0) LED_PORT_OUT &= ~LED_2; halLcdPrintLineCol(" Stop ", 8, 1, OVERWRITE_TEXT); halButtonsInterruptDisable( BUTTON_S2 ); // Activate LPM during DMA playback, wake-up when finished __bis_SR_register(LPM0_bits + GIE); // Enable interrupts, enter LPM0 halLcdPrintLine(" DONE ", 6, INVERT_TEXT | OVERWRITE_TEXT); halButtonsInterruptEnable( BUTTON_S2 ); halLcdPrintLineCol("Record", 8, 1, OVERWRITE_TEXT); halLcdPrintLineCol("Play", 8, 12, OVERWRITE_TEXT); // Power-down MSP430 modules TBCTL = 0; // Disable Timer_B PWM generation AUDIO_OUT_SEL &= ~AUDIO_OUT_PIN; // P4.4 = TB4 buttonsPressed = 0;}
#pragma vector=TIMERB1_VECTOR __interrupt void TIMERB1_ISR(void){ //static int counter = 0; switch (TBIV) { case 14 : // if (++counter == 8) //{ // counter = 0; TBCCR4 = (*( (unsigned char*)PlaybackPtr) );//data lost 32bit-8bit = 24bits(3 Byte)(only last 8 bit data are transferred on output pin for playback) PlaybackPtr++; if ((unsigned long) PlaybackPtr >= (lastAudioByte)) { TBCTL = 0; __bic_SR_register_on_exit(LPM0_bits); } //}}}
yes watchdog timer Disabled in main and no interrupts are used except button interrupts in code I am trying to write audio data into flash which is coming from UART ,
whether uart receive buffer size is 255 .and data coming is too large it is updating the usb buffer every time because of that data is not properly store at memstart......is this reason for reseting..........when it put loop like this it go into loop only once
while checking i print value of temp on LCD ,it must print updated value every time but it will not and when byte transferred from uart is exceeded 1245 it will reset the board
while(audioReceiveBuffer[j]!= '\0')
{
halLcdPrintLineCol((char*)temp,2,1,OVERWRITE_TEXT);LED_PORT_OUT |= LED_1;data_32 = temp[3];data_32 = data_32 >> 8;data_32 |= temp[2];data_32 = data_32 >> 8;data_32 |= temp[1];data_32 = data_32 >> 8;data_32 = temp[0];memstart = data_32; //4 bytes are loaded over flash memory locationmemstart++;count = count + 4;LED_PORT_OUT &= ~LED_1;
}