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.

Spi in second F28377D CPU (CPU02)

In my design, I planned the PWM's and the ADC's in core 1 and SPI and QEP in CPU02. All of the functions already were tested on cpu1 and run brilliantly, also SpiA in Hi-speed mode at 20 MHz, using pins 58...61

I am new on TI, CCS, but I am impressed by the easines of documentation, until now:

To learn how to run SPI on cpu2, I tried to change the Example spi_loopback_dma, without success.
I initiated all of the GPIO and the SPI-registers in cpu1 as GPIO's can not be initiated in Cpu2.
GpioCtrlRegs.GPBLOCK.bit.GPIO58 = 0;// etc. for the pins 59, 60 and 61
GpioCtrlRegs.GPBQSEL2.bit.GPIO58 = 3; // Asynch etc.
GpioCtrlRegs.GPBGMUX2.bit.GPIO58 = 3; //spi hi-speed etc(take care: the documentation talks 0x11 instead of 11b)
GpioCtrlRegs.GPBMUX2.bit.GPIO58 = 3; // id. etc

To set SPI in HiSpeed:
SpiaRegs.SPICCR.bit.HS_MODE = 1; // "Reserved bit5" Hispeed mode

Then I changed ownership of SPI and GPIO-pins to Cpu2
GpioCtrlRegs.GPBCSEL4.bit.GPIO58 = 2;// etc, for 59...61 cpu2
DevCfgRegs.DEVCFGLOCK1.bit.CPUSEL6 = 0; // unlock
DevCfgRegs.CPUSEL6.bit.SPI_A = 1; // spi to cpu2
DevCfgRegs.DEVCFGLOCK1.bit.CPUSEL6 = 1; // lock
----until here everything is done in cpu1.

In CPU2 the DMA code is initiated without change from the example code as I understand that each core has its own DMA and registers.
Point is that this is a trial and error approach as there are no example codes for running peripherals on cpu2.
Is there some documentation that I missed? or am I the first to do this? In order to find the many things that I do wrong, I need to know which of the code is securely correct according to TI . Most importantly, what are the rules for initiating Spi in CPu2
Pls help.
Henk Schutte
Amsterdam

  • Hi Henk,

    If you have working code on CPU1 then you should be able to port same to CPU2 (including DMA code) without any issue. Following is what need to be done by CPU1 code -

    - Setup GPIO mux for SPI operation.

    - Assign the ownership of SPI to CPU2  (DevCfgRegs.CPUSEL6.bit.SPI_A = 1; // spi to cpu2).

    You don't need to assign the GPIO ownership to CPU2. That's only needed if you are using the pin as GPIO and want to control the pin using GPIO registers of CPU2 (please refer "Figure 7-1. GPIO Logic for a Single Pin" in TRM).

    Not sure if you were able to port the SPI code to CPU2 successfully or not.

    We appreciate your feedback on documentation and we'll see how to improve the same to make it better.

    Regards,

    Vivek Singh

  • Thanks, Vivec,

    Awaiting an answer, I found the example code to run pwm and adc on core2 and decided to follow this stategy, Everything runs perfectly now on cpu2 and Spi and Qep on cpu1. Was done in 2 days!

    The nice thing about the example codes is that the code certainly works and if  not, you must find where you made the mistake.

    Henk