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.

no SPI clock on the oscilloscope

Other Parts Discussed in Thread: ADS1271, TMS570LS1224, HALCOGEN

Hi

Im using TMS570LS1224 with an ADS1271 (no chip select and no SIMO)

I was trying to test the SPI by checking the SCLK but nothing... I don't know whats happening... I also checked for the examples on the Halcogen and didn't found any difference on the instructions... the only difference is that Im using SPI5 instead of 1. I already checked the congifuration and everything but still no clock....

any idea of why this could be happening?? shouldnt be there something like a "start clock" or something? what am I missing??

 while(blocksize != 0U)
    {
        if((spi->FLG & 0x000000FFU) != 0U)
        {
           break;
        }

        if(blocksize == 1U)
        {
           Chip_Select_Hold = 0U;
        }
        /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
        Tx_Data = *srcbuff;

        spi->DAT1 =((uint32)DataFormat << 24U) |
                   ((uint32)ChipSelect << 16U) |
                   (WDelay)           |
                   (Chip_Select_Hold) |
                   (uint32)Tx_Data;
        /*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
        srcbuff++;
        /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Hardware status bit read check" */
        while((spi->FLG & 0x00000100U) != 0x00000100U)
        {
        } /* Wait */
        //SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
        *destbuff = (uint16)spi->BUF;
        /*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
        destbuff++;

        blocksize--;
    }

also... putting a breakpoint under the red lines (on destbuff++), I never get out of there... this is supposed to be the Polling method (I can't use the interrupt method because on the application Im already on a higher level interrupt, so no scape from there until finish) but I have no idea of what is it waitting there.... on the example code there is no reference of this part...

thanks!

  • Writing to spi->DAT1 is what starts the clock if the SPI is configured properly. Did you configure SPI5 as master mode with internally generated clock?


  • yees I did... and nothing....
    spiDAT1_t dataconfig1_t;
    //Check spi.h lines 116 and 56
    dataconfig1_t.CS_HOLD = FALSE;
    dataconfig1_t.WDEL = 0;
    dataconfig1_t.DFSEL = SPI_FMT_0;
    dataconfig1_t.CSNR = SPI_CS_NONE;

    here is the config on DAT1 Im using.
    and also... (the red lines didn't appear) but on the the code gets stuck on
    while((spi->FLG & 0x00000100U) != 0x00000100U)
    {
    } /* Wait */
    but no clock seen...
  • Do you use the SPI5nENA pin? If yes, then it must be low before the read can start. If no, then it must be configured as GIO in HALCoGen.

  • no... Im not using ENA... Im just running the function on polling mode to see if its working so later today I can test the full code. the main goes to GIOB 2 interrupt on low level, there the code is sent to SPI and receive the data and then go back. But the clock is not working....
  • Check your pin muxing tab. I have attached a small project I made that reads 4 16-bit values off of SPI5. I see the SPICLK pin toggling.

    5661.TMS570LS1224_SPI5.zip

  • Thanks!!! It already worked!! I dont know yet if im receiving the data correctly but at least the code is doing what its supposed to do
    Thanks!!!
  • Bob
    One more question... Im using already the code with the GIOB 2 interrupt and works. Just... one problem... It goes there once and then never repeat the action. I think is an issue with the flag of the GIO. How can I clear that flag?
    best regards
  • You clear the interrupt request flag by reading the GIO Offset register, GIO Offset A if it is a high level interrupt, GIO Offset B if it is a low level interrupt. From page 1268 of SPNU515:

  • okok, so the flag clears with

    uint32 offset = gioREG->OFF2;

    but for some reason the interrupt only occurs once...

    look:

    this is what I have inside the gionotification:

    void gioNotification(gioPORT_t *port, uint32 bit)

    {

    /*  enter user code between the USER CODE BEGIN and USER CODE END. */

    /* USER CODE BEGIN (19) */

    if((bit==2)&&(port==gioPORTB))

    {

    spiInit();

    spiDAT1_t dataconfig1_t;

    //Check spi.h lines 116 and 56

    dataconfig1_t.CS_HOLD = FALSE;

    dataconfig1_t.WDEL    = 0;

    dataconfig1_t.DFSEL   = SPI_FMT_0;

    dataconfig1_t.CSNR    = SPI_CS_NONE;

    spiReceiveData(spiREG5, &dataconfig1_t, 20, RX_Data_Master);

    /*do{

    //nothing

    }while(done==0);*/

    c_rx--;

    if(c_rx<=0)

    {

    c_rx=0;

    do{

    even=c_rx; //par

    odd=c_rx+1; //impar

    muscle_data[m_count]=(RX_Data_Master[even]<<12 & RX_Data_Master[odd]);

    c_rx+=2;

    m_count++;

    }while(c_rx<20 && m_count<1000);

    c_rx=20;

    if(m_count>999)

    m_count=0;

    }

    done=1;

    }

    //return done;

    //hacer barrido y guardar los datos en otra variable, ya concatenados en muscle_data

    /* USER CODE END */

    }

    first I read the SPI,  I know that the interrupt should be something short but in this case, this data Im receiving, is the most important data (I can't do anything without it so Im getting all the data I need first) but for some reason, when debugging, I put a breakpoint inside the gio_low_level_interrupt and I only got there once... 

    Im not sure whats going on... because the first line clears the flag... shouldnt I get there every time??

    thanks Bob!!

  • Not sure why you are only getting one interrupt. I modified my program to generate an interrupt on GIOA2, and it generates an interrupt each time I pull the pin high.

    2045.TMS570LS1224_SPI5.zip