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.

CSL Bugs

Guru 15580 points

I believe there are significant bugs in the latest CSL. Both the SPI_init() and the UART_init() functions reset the Peripheral Group 4 register. The effectively prevents you from using both the SPI and UART simultaneously.

From UART_init()

CSL_FINST(uartObj->sysAddr->PRCR, SYS_PRCR_PG4_RST,RST);

And from SPI_init()

/* Value of 'Reset Counter' */
CSL_FINS(sysRegs->PSRCR, SYS_PSRCR_COUNT, 0x20);
CSL_FINS(sysRegs->PRCR, SYS_PRCR_PG4_RST, CSL_SYS_PRCR_PG4_RST_RST);
for(delay = 0; delay < 100; delay++);

FYI, DMA_init() correctly resets only the DMA bit in the PG4 register.

/* Set the reset clock cycle */
CSL_FINS(CSL_SYSCTRL_REGS->PSRCR, SYS_PSRCR_COUNT, CSL_DMA_RESET_CLOCK_CYCLE);
CSL_FINST(CSL_SYSCTRL_REGS->PRCR, SYS_PRCR_DMA_RST, RST);

One workaround I have found is to "re-init" either the SPI or UART after init-ing the other peripheral.

void Re_init_UART()
{
UART_setup(hUart,&uart_setup);
}

Several others have reported issues with using SPI and UART simultaneously.

 

  • Mike:

    What do you mean by simultaneously?

    I have SPI and UART running on a C5505. I do not see a problem with the operation. I am getting valid info over each, both sending and receiving.

     

  • Hi Todd,

    Todd Anderson78572 said:
    What do you mean by simultaneously?

    I mean initializing and using both peripherals in the same program, without re-configuring either of them in real time.

    Todd Anderson78572 said:
    I do not see a problem with the operation. I am getting valid info over each, both sending and receiving.

    Are you using the CSL?

    What I have found is, when you initialize either the UART or the SPI port using CSL API functions, the initialization routine (of each) resets peripheral group 4 so that any configuration done on the other peripheral is reset to zero. It does not matter which one you initialize first since the reset occurs in both XXX_init() functions.

    Let me know if you agree or disagree with this.

  • I am using CSL for SPI, and I initialized the UART thru non-CSL code that was part of Spectrum Digital's example programs. Even though I initialize the SPI after UART, I do not see the problems that you mention. Both SPI and UART are running fine.

    Are you sure your problem is related to CSL?

     

  • Todd,

    Todd Anderson78572 said:
    Are you sure your problem is related to CSL?

    Yes. I have verified the problem and found a workaround (show above).

    Todd Anderson78572 said:
    I am using CSL for SPI, and I initialized the UART thru non-CSL code that was part of Spectrum Digital's example programs.

    I was actually doing just the opposite earlier (SD BSL for SPI and CSL for UART). When I re-wrote my SPI code for CSL I found the problem.

    I hope this helps!

  • MikeH said:

    FYI, DMA_init() correctly resets only the DMA bit in the PG4 register.

     

    I had problems with this where the general DMA reset seemed to disturb the USB DMA, which had been previously configured.  When I eliminated the call to DMA_init() the problem went away.

     All peripheral resets for the C5515 should be handled globally; they just aren't modular like CSL would have us believe.

     

     

  • Hi,

    I encountered with the same problem of CSL, it fails to run both uart and spi. Actually, after I follow your solution UART works with SPI , however UART interrupt function fails to work. I mean transfer of characters works but UART interrupt fails. Do you have any idea about this?

    Regards.

    Yusuf

  • Yusuf,

    I use DMA events, not interrupts, for my transfers so I can't really comment on whether they are currently working. However, I believe the interrupts were working properly when I was debugging earlier. The only advice I can give is to step through each line of code, including CSL source, as you debug your code. This way you can watch the C55xx registers in CCS register view window to see if the interrupts are indeed enabled and/or firing.

    I SURE WISH TI WOULD COMMENT ON THESE ISSUES AND OFFER A FIX.

  • This is fixed in latest CSL.  SYS_peripheralReset(CSL_SysPGFlags flag) is called by each peripheral’s init() function. It makes sure the system reset for the groups PG1, PG3, and PG4 is only called once per program. PG1_flag, PG3_flag and PG4_flag, are set to ensure reset is performed only once per group in csl_sysctrl.c.

    Regards

  • Great! Thanks for the update Steve.