AnsweredAssumed Answered

BF537 cann't use the SPORT0_TX interrupt

Question asked by SD_Sam on Jul 22, 2015
Latest reply on Sep 3, 2015 by SachinV

The register-based DMA4 is used to deliver the data. The DMA initialization as below:

void Init_DMA(void)

    // Configure DMA4

    *pDMA4_PERIPHERAL_MAP = 0x4000;

    // 32-bit transfers, Autobuffer mode

    *pDMA4_CONFIG = WDSIZE_16 | 0x1000 ;

    // Start address of data buffer

    *pDMA4_START_ADDR = iTxBuffer1;    // section("sdram0_bank1") unsigned short  iTxBuffer1[64*1024];

    // DMA loop count

    *pDMA4_X_COUNT = 0xffff;

    // DMA loop address increment

    *pDMA4_X_MODIFY = 2;




In the main function, the audio wave file was read into buffer[1024*1024].

    fp1 = fopen("../3.wav", "rb");

    printf("open signal file1!\n");

    printf("read signal data1!\n");

    //fread(iTxBuffer1, 2, 64*1024, fp1);

    fread(buffer, 2, 1024*1024*1, fp1);



At first, I use memcpy the first block 64*1024 data from buffer to iTxbuffer. And the DMA4 can successfully deliver the data to SPORT0. But BF537 will repeat the first block instead of getting into the SPORT0_TX interrupt. The rest block will be copied to iTxbuffer each time in the interruption.


Please help me. Thanks.

My final purpose is to play back all the audio wav file by register-based DMA.


The initialization of interrupt is as follow.

void Init_Interrupts(void)


    *pSIC_IAR0 = 0xf2ffffff;

    *pSIC_IAR1 = 0xffffffff;

    *pSIC_IAR2 = 0xffffffff;

    *pSIC_IAR3 = 0xffffffff;


    // assign ISRs to interrupt vectors

    // Sport0 TX ISR -> IVG 9

    register_handler(ik_ivg9, Sport0_TX_ISR);


    // enable Sport0 TX interrupt

    *pSIC_IMASK = (*pSIC_IMASK | 0x00000040);