Hi all, I'm writing an app which allows me to load a .out onto my dsp board, and in turn to communicate with my board (C6711DSK). So far I have been successful using handshaking, but I would also like to interrupt the board and I cant seem to get this working. I imagine the problem isn't major, and that I've probably left out something simple. So anyway I guess the best idea is for me to include the code I'm using. Below is my target .out file with I'm loading to the board using my app. As you can see, I'm enabling GIE and INT13's IE - do I need to do anything else? The target .out program processes two hand shaking commands - LEDS_ON and LEDS_OFF, while the interrupt should turn off the leds. #include <stdio.h> #include <c6x.h> #include "c6211dsk.h" #include "cnfDSP.h" #include "dsk6xHSB.h" #pragma DATA_SECTION(handShakingBuffer, "my_DataSect") int handShakingBuffer[HS_BUFFER_LEN]; int newFlag; /*-------------------------------------------------------------------------*/ /* main() */ /*-------------------------------------------------------------------------*/ int main() { unsigned int io_port_values; /* dsp and peripheral initialization */ CSR=0x100; IER=0x0002; ICR=0xffff; newFlag = 0; *(unsigned volatile int *)EMIF_CE0 = 0x30; /* EMIF CE0control */ /*-----------------------------------------------------------------------*/ /* Read DIP switches */ /*-----------------------------------------------------------------------*/ *(unsigned volatile int *)EMIF_CE1 = CE1_32;// EMIF CE1 control, 32bit async io_port_values=get_ioport(); *(unsigned volatile int *)EMIF_CE1 = CE1_8;// EMIF CE1 control, 8bit async /*-----------------------------------------------------------------------*/ /* Perform Hand Shaking */ /*-----------------------------------------------------------------------*/ handShakingBuffer[0] = ID_0; handShakingBuffer[1] = ID_1; handShakingBuffer[2] = ID_2; handShakingBuffer[3] = 0; handShakingBuffer[4] = 0; handShakingBuffer[5] = io_port_values; /*-----------------------------------------------------------------------*/ /* Wait for Host ACK */ /*-----------------------------------------------------------------------*/ while(handShakingBuffer[4] != HOST_RECEIVE_HAND_SHAKING_INFO); /*-----------------------------------------------------------------------*/ /* Reset handShakingBuffer */ /*-----------------------------------------------------------------------*/ handShakingBuffer[0] = 0; handShakingBuffer[1] = 0; handShakingBuffer[2] = 0; #if PRINT printf("Hand Shake Complete.\n"); #endif CSR=0x1; //set GIE IER=0x2002; //set HPI /*-----------------------------------------------------------------------*/ /* Run DSP forever */ /*-----------------------------------------------------------------------*/ while(1) { /*-----------------------------------------------------------------------*/ /* Test for HOST ready */ /*-----------------------------------------------------------------------*/ #if PRINT printf("\nDSP Ready for HOST Command.\n"); #endif /*---------------------------------------------------------------------*/ /* Wait until HOST has a command and parameters ready */ /*---------------------------------------------------------------------*/ while(handShakingBuffer[4] != HOST_STATUS_INPUT_READY && handShakingBuffer[4] != HOST_STATUS_END_PROCESSING); /*---------------------------------------------------------------------*/ /* Quit if HOST requests it or Process a HOST command */ /*---------------------------------------------------------------------*/ if(handShakingBuffer[4] == HOST_STATUS_END_PROCESSING) { #if PRINT printf("\nHOST Requested End of Processing.\n"); #endif break; } else { handShakingBuffer[4] = DSP_PROCESSING_COMMAND; } #if PRINT printf("\nNew HOST Command Read: "); #endif /*---------------------------------------------------------------------*/ /* Process a HOST command */ /*---------------------------------------------------------------------*/ switch(handShakingBuffer[3]) { case LEDS_OFF: *(unsigned volatile int *)EMIF_CE1 = CE1_32;// EMIF CE1 control, 32bit async ledOff(); handShakingBuffer[5]=0;//TIMER_OK; *(unsigned volatile int *)EMIF_CE1 = CE1_8;// EMIF CE1 control, 8bit async break; /*-------------------------------------------------------------------*/ /* Run the QDMA test and return information if(error) */ /*-------------------------------------------------------------------*/ case LEDS_ON: *(unsigned volatile int *)EMIF_CE1 = CE1_32;// EMIF CE1 control, 32bit async ledOn(); handShakingBuffer[5]=0;//LEDS_OK; *(unsigned volatile int *)EMIF_CE1 = CE1_8;// EMIF CE1 control, 8bit async break; } /*---------------------------------------------------------------------*/ /* Tell the HOST that DSP processing is done for this command */ /*---------------------------------------------------------------------*/ handShakingBuffer[4] = DSP_STATUS_OUTPUT_READY; } while(1); return(0); } void ledOn() { *(unsigned volatile int *)IO_PORT = 0x0000000;/* turn on user leds */ } void ledOff() { *(unsigned volatile int *)IO_PORT = 0x7000000;/* turn off user leds */ } /*-------------------------------------------------------------------------*/ /* get_ioport() - used to read state of ioport */ /*-------------------------------------------------------------------------*/ unsigned int get_ioport(void) { return(*(unsigned volatile int *)IO_PORT); } interrupt void hpi_isr() { *(unsigned volatile int *)EMIF_CE1 = CE1_32;// EMIF CE1 control, 32bit async ledOff(); *(unsigned volatile int *)EMIF_CE1 = CE1_8;// EMIF CE1 control, 8bit async } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// OK, this is my vector table - * * TI Proprietary Information * Internal Data * .ref _hpi_isr .ref _c_int00 .sect "vectors" RESET_RST: mvkl .S2 _c_int00, B0 mvkh .S2 _c_int00, B0 B .S2 B0 NOP NOP NOP NOP NOP NMI_RST: NOP NOP NOP NOP NOP NOP NOP NOP RESV1: NOP NOP NOP NOP NOP NOP NOP NOP RESV2: NOP NOP NOP NOP NOP NOP NOP NOP INT4: NOP NOP NOP NOP NOP NOP NOP NOP INT5: NOP NOP NOP NOP NOP NOP NOP NOP INT6: NOP NOP NOP NOP NOP NOP NOP NOP INT7: NOP NOP NOP NOP NOP NOP NOP NOP INT8: NOP NOP NOP NOP NOP NOP NOP NOP INT9: NOP NOP NOP NOP NOP NOP NOP NOP INT10: NOP NOP NOP NOP NOP NOP NOP NOP INT11: NOP NOP NOP NOP NOP NOP NOP NOP INT12: NOP NOP NOP NOP NOP NOP NOP NOP INT13: b _hpi_isr NOP NOP NOP NOP NOP NOP NOP INT14: NOP NOP NOP NOP NOP NOP NOP NOP INT15: NOP NOP NOP NOP NOP NOP NOP NOP /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Finally the app, which allows the user to turn off or on the leds - /*-------------------------------------------------------------------------*/ /* FILENAME: dsk6xtst.c -- DSK Confidence Test - HOST Code */ /* */ /* Rev 2.01 11 May 2001 T.J.Dillon */ /* */ /*-------------------------------------------------------------------------*/ /* HISTORY */ /* Rev 1.00 Created */ /* Rev 1.10 Mods a) LEDS and CODEC parameter passing */ /* b) Removed FLASH checksum */ /* c) Changes for new Win32 DLL API for generic API */ /* Rev 1.20 Mods -- Added -pport options */ /* Rev 1.21 Mods -- Reorganize to be consistent with Manufacturing Test */ /* Rev 1.25 Mods -- Update with latest Win32 DLL API */ /* Rev 1.26 Mods -- Added -pd option */ /* Rev 1.30 Mods -- Added board revision info */ /* Rev 2.00 Mods -- Update for C6711 DSK */ /* Rev 2.01 Mods -- Update for CCS2.0 Support */ /* */ /*-------------------------------------------------------------------------*/ #include <stdio.h> #include <windows.h> #include "dsk6x11hpi.h" #include "dsk6xHSB.h" #include "dsk6xtst.h" const ULONG DSPHS_BUFFER_ADDRESS = 0x200; /* Start Int Mem */ static FILE *pBoardFile = NULL; #define STRING_BUFFER_SIZE (80) #define ULONG unsigned long static void PrintMenu( void ); /*-------------------------------------------------------------------------*/ /* main() */ /*-------------------------------------------------------------------------*/ void main(int argc1, char *argv1[]) { int finished = 0; dskHANDLE hBd; /* Board device handle */ short iBd = 0; /* Board index */ BOOL bExcl = 1; /* Exclusive open = TRUE */ short iMp = 1; /* Map selector = MAP1 */ char coffNam[20]= "CnfDSP.out"; /* COFF file name */ char *sBoardFile; BOOL bVerbose = 0; /* COFF load verbose mode = FALSE */ BOOL bClr = 0; /* Clear bss mode = FALSE */ BOOL bDump = 0; /* Dump mode = FALSE */ ULONG handShakingBuffer[HS_BUFFER_LEN], readLength, writeLength; int handShakingFlag, dspProcFlag; int choice; ULONG command; /* Command variable to run each test on DSP */ /*-----------------------------------------------------------------------*/ /* Parse Command Line */ /*-----------------------------------------------------------------------*/ sBoardFile = "F:\\ti\\c6000\\dsk6x11\\doc\\ti_ppdsk.cfg"; pBoardFile = fopen( sBoardFile, "r" ); if ( pBoardFile == NULL ) { printf( "ERROR: Please specify a valid board configuration file via the -f option.\n" ); exit(1); } else { fclose(pBoardFile); } /*-----------------------------------------------------------------------*/ /* Open a driver connection to a dsk6x board. */ /*-----------------------------------------------------------------------*/ if ( !dsk6x_open(sBoardFile,&hBd) ) { exit(1); } /*-----------------------------------------------------------------------*/ /* Cause a DSP reset. */ /*-----------------------------------------------------------------------*/ if ( !dsk6x_reset_dsp(hBd,0,1) ) { exit(2); } /*-----------------------------------------------------------------------*/ /* Establish a connection to the HPI of a target board. */ /*-----------------------------------------------------------------------*/ if ( !dsk6x_hpi_open(hBd)) { exit(3); } /*-----------------------------------------------------------------------*/ /* Read a COFF file and write the data to DSP memory. */ /*-----------------------------------------------------------------------*/ if (dsk6x_coff_load(hBd,coffNam,bVerbose,bClr,bDump)) { exit(4); } /*-----------------------------------------------------------------------*/ /* Generate a DSPINT to start program */ /*-----------------------------------------------------------------------*/ if (!dsk6x_hpi_generate_int(hBd)) { exit(5); } /*---------------------------------------------------------------------*/ /* Handshaking. Keep reading until hand shake is done. */ /*---------------------------------------------------------------------*/ do { readLength = HS_BUFFER_LEN*4; /* 4 bytes for 1 word */ /*-------------------------------------------------------------------*/ /* Test if handShakingBuffer actually read (completely) */ /*-------------------------------------------------------------------*/ if (!dsk6x_hpi_read(hBd, handShakingBuffer, &readLength, DSPHS_BUFFER_ADDRESS) || readLength != HS_BUFFER_LEN*4) { /* evm6x_hpi_read() failed */ continue; // try again } /*-------------------------------------------------------------------*/ /* Test if handShakingBuffer contains correct ID */ /*-------------------------------------------------------------------*/ handShakingFlag = 0; // reset hand shaking flag if(handShakingBuffer[0] != ID_0) handShakingFlag = 1; if(handShakingBuffer[1] != ID_1) handShakingFlag = 1; if(handShakingBuffer[2] != ID_2) handShakingFlag = 1; } while (handShakingFlag == 1); /*---------------------------------------------------------------------*/ /* Send hand shaking ACK to Target(DSP) */ /*---------------------------------------------------------------------*/ writeLength = 4; handShakingBuffer[4] = HOST_RECEIVE_HAND_SHAKING_INFO; dsk6x_hpi_write(hBd, &handShakingBuffer[4], &writeLength, DSPHS_BUFFER_ADDRESS+4*4); /*---------------------------------------------------------------------*/ /* Display Menu First time */ /*---------------------------------------------------------------------*/ printf("\nEnter 1 for led off, 2 for leds on, 3 for interupt - leds off, other to escape\n"); /*---------------------------------------------------------------------*/ /* Do while loop for repeat of choices */ /*---------------------------------------------------------------------*/ do { printf("\nChoice: "); scanf("%d", &choice); if(choice == 1) command = LEDS_OFF; else if(choice == 2) command = LEDS_ON; else if(choice == 3) dsk6x_hpi_generate_int(hBd); else finished = 1; if(choice!=1||choice!=2) { /*-------------------------------------------------------------------*/ /* Send command to Target(DSP) */ /*-------------------------------------------------------------------*/ writeLength = 4; handShakingBuffer[3] = command; dsk6x_hpi_write(hBd, &handShakingBuffer[3], &writeLength, DSPHS_BUFFER_ADDRESS+3*4); /*-------------------------------------------------------------------*/ /* Tell Target(DSP) that Host is ready */ /*-------------------------------------------------------------------*/ writeLength = 4; handShakingBuffer[4] = HOST_STATUS_INPUT_READY; dsk6x_hpi_write(hBd, &handShakingBuffer[4], &writeLength, DSPHS_BUFFER_ADDRESS+4*4); dspProcFlag = 1; /*-------------------------------------------------------------------*/ /* Wait for Target(DSP) to tell you it is done! */ /*-------------------------------------------------------------------*/ do { readLength = 4; dsk6x_hpi_read(hBd, &handShakingBuffer[4], &readLength, DSPHS_BUFFER_ADDRESS+4*4); if(handShakingBuffer[4] == DSP_STATUS_OUTPUT_READY) dspProcFlag = 0; // DSP is done processing } while(dspProcFlag); /*---------------------------------------------------------------------*/ /* Test for yes answer to repeat processing */ /*---------------------------------------------------------------------*/ } } while (!finished); /*-----------------------------------------------------------------------*/ /* Tell Target(DSP) that HOST is done! */ /*-----------------------------------------------------------------------*/ writeLength = 4; handShakingBuffer[4] = HOST_STATUS_END_PROCESSING; dsk6x_hpi_write(hBd, &handShakingBuffer[4], &writeLength, DSPHS_BUFFER_ADDRESS+4*4); /*-----------------------------------------------------------------------*/ /* Close the new HPI session started with evm6x_hpi_open() */ /*-----------------------------------------------------------------------*/ if (!dsk6x_hpi_close(hBd)) { exit(6); } /*-----------------------------------------------------------------------*/ /* Close a previously opened driver connection to a board. */ /*-----------------------------------------------------------------------*/ if (!dsk6x_close(hBd)) { exit(7); } exit(0); } /* end of main() */
HPI host to target interrupting
Started by ●August 10, 2003
Reply by ●August 11, 20032003-08-11
I'm still having no luck with this one guys, could someone suggest something I could try out to narrow down the issue here, Thanks very much, Aine.
Reply by ●August 12, 20032003-08-12
aine_canby@yahoo.com (�ine Canby) wrote in message news:<57ed59a.0308111338.3bc93766@posting.google.com>...> I'm still having no luck with this one guys, > could someone suggest something I could try out to narrow down the issue here, > Thanks very much, > > Aine.Hi, It has been a long time since I touch TI DSK so I forgot all the technical detail but you can go to http://mirriwinni.cs.jcu.edu.au/~phillip/dsp/ and download the utilities. http://mirriwinni.cs.jcu.edu.au/~phillip/dsp/dsk_loader_parallel.tar.gz It done similar thing you want to do in Windows but It run under Unix with source code so you can look at it for reference. Good luck
Reply by ●August 13, 20032003-08-13
Thanks for the reply Duy. I am now at the stage where I am simply trying to manually call an interrpt - interrupt 13 from a simple program, and I cant even get that to work. Here is the code I'm using. The Interrupt is not being triggered when I write to the ISR register. Can anyone tell me what I'm doing wrong? Thanks very much, Aine. #include <stdio.h> #include <c6x.h> #include "c6211dsk.h" #include "cnfDSP.h" #include "dsk6xHSB.h" #pragma DATA_SECTION(handShakingBuffer, "my_DataSect") int handShakingBuffer[HS_BUFFER_LEN]; /*-------------------------------------------------------------------------*/ /* main() */ /*-------------------------------------------------------------------------*/ int main() { /* dsp and peripheral initialization */ CSR=0x100; /* disable all interrupts */ IER=1; /* disable all interrupts except NMI */ ICR=0xffff; /* clear all pending interrupts */ *(unsigned volatile int *)EMIF_CE0 = 0x30; /* EMIF CE0control */ ICR = IFR | 0x2000; IER |= 0x2002; // enable int 13 CSR |= 1; ISR=0x2000; return(0); } void ledOn() { *(unsigned volatile int *)IO_PORT = 0x0000000;/* turn on user leds */ } void ledOff() { *(unsigned volatile int *)IO_PORT = 0x7000000;/* turn off user leds */ } interrupt void hpi_isr() { *(unsigned volatile int *)EMIF_CE1 = CE1_32;// EMIF CE1 control, 32bit async ledOn(); *(unsigned volatile int *)EMIF_CE1 = CE1_8;// EMIF CE1 control, 8bit async newFlag = 1; } *** Vector.asm - * * TI Proprietary Information * Internal Data * .ref _c_int00 .ref _hpi_isr .ref _isr4 .sect "vectors" RESET_RST: mvkl .S2 _c_int00, B0 mvkh .S2 _c_int00, B0 B .S2 B0 NOP NOP NOP NOP NOP NMI_RST: NOP NOP NOP NOP NOP NOP NOP NOP RESV1: NOP NOP NOP NOP NOP NOP NOP NOP RESV2: NOP NOP NOP NOP NOP NOP NOP NOP INT4: NOP NOP NOP NOP NOP NOP NOP NOP INT5: NOP NOP NOP NOP NOP NOP NOP NOP INT6: NOP NOP NOP NOP NOP NOP NOP NOP INT7: NOP NOP NOP NOP NOP NOP NOP NOP INT8: NOP NOP NOP NOP NOP NOP NOP NOP INT9: NOP NOP NOP NOP NOP NOP NOP NOP INT10: NOP NOP NOP NOP NOP NOP NOP NOP INT11: NOP NOP NOP NOP NOP NOP NOP NOP INT12: NOP NOP NOP NOP NOP NOP NOP NOP INT13: b _hpi_isr NOP NOP NOP NOP NOP NOP NOP INT14: NOP NOP NOP NOP NOP NOP NOP NOP INT15: NOP NOP NOP NOP NOP NOP NOP NOP *** lnk.cmd - -c -heap 0x500 -stack 0x500 /* very large stack for DSP programs. */ -lrts6201.lib MEMORY { vecs: o = 00000000h l = 00000200h I_HS_MEM: o = 00000200h l = 00000020h IRAM: o = 00000220h l = 0000FDE0h CE0: o = 80000000h l = 01000000h } SECTIONS { "vectors" > vecs my_DataSect > I_HS_MEM .cinit > IRAM .text > IRAM .stack > IRAM .bss > IRAM .const > IRAM .data > IRAM .far > IRAM .switch > IRAM .sysmem > IRAM .tables > IRAM .cio > IRAM }
Reply by ●August 13, 20032003-08-13
�ine Canby wrote:> > Thanks for the reply Duy. I am now at the stage where I am simply > trying to manually call an interrpt - interrupt 13 from a simple > program, and I cant even get that to work. Here is the code I'm using. > The Interrupt is not being triggered when I write to the ISR register. > Can anyone tell me what I'm doing wrong? > > Thanks very much, > > Aine. >...> > INT13: b _hpi_isr > NOP > NOP > NOP > NOP > NOP > NOP > NOP >... I don't see how interrupt 13 returns. Did I miss something? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●August 14, 20032003-08-14
Hi, i work with 54x, without DSP/BIOS, but i don't read about any doing for interrupt event: call if software interrupt, or setup if CCS simulation, or pulse on pin. Cheers
Reply by ●August 14, 20032003-08-14
Vic wrote:> > Hi, > i work with 54x, without DSP/BIOS, but i don't read about any doing > for interrupt event: call if software interrupt, or setup if CCS > simulation, or pulse on pin. > > CheersI don't know the language you use for programming, but if you dig into the architecture and perhaps also the assembly commands associated with interrupt operation, the answer to your question (which you didn't actually ask) is likely to come clear. -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������