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.

TMS320F28034: question about GPIO toggle speed and asm("NOP") delay time

Part Number: TMS320F28034

Hi Team,

There is an issue from the customer need your help:

F28034, driver IO control WS2812B chip. The crystal oscillator uses internal INTOSC1 to multiply to 50M, adding an asm ("NOP"); statement, about 300ns increase the time, in theory, is not the 50ns corresponding to the 20M clock?

The first high time in the picture executes two asm ("NOP"); , the second high time performed three asm ("NOP");. The GPAQSEL1 register is configured as asynchronous. I want to know asm("NOP"); Why is latency not clock cycles, or is there another more precise delay method.

It's strange that I cannot attach my picture in this post.

void WS2812B_tx(void)
{
    Uint16 ws2812hl[24],rgb,i;

    rgb = WS2812.GRB;
    for(i=0;i<24;i++)
    {
        if((rgb & 0x00800000) == 0x800000)
            ws2812hl[i] = 1;
        else
            ws2812hl[i] = 0;
        rgb = rgb << 1;
    }
    if(ws2812hl[0])
    {
         ws2812b_H;
         asm(" NOP");asm(" NOP");asm(" NOP");
         ws2812b_L;
         //asm(" NOP");
    }
    else
    {
        ws2812b_H;
        asm(" NOP");asm(" NOP");
        ws2812b_L;
        //asm(" NOP");
   }

    if(ws2812hl[1])
    {
         ws2812b_H;
         asm(" NOP");asm(" NOP");asm(" NOP");
         ws2812b_L;
         //asm(" NOP");
    }
    else
    {
        ws2812b_H;
        asm(" NOP");asm(" NOP");
        ws2812b_L;
        //asm(" NOP");
   }

Could you help check this case?

Thanks & Regards,

Ben

  • Due to holiday on account of Memorial Day, please expect a response on Tuesday.

    Thanks.

  • Ben,

    Can you check the .cmd(linker) file to see if the code is executing from flash or RAM memory?  If it is executing from flash, then there will be an additional cycle since we need an additional 1 wait state.  This would mean each "NOP" takes 40ns vs 20ns(1/50MHz), but we are still a bit off the 300ns you see vs the 120ns that 3 "NOP" instructions should give

    Can you also check to see if the flash WS have been configured properly(assuming we are running from flash); the default WS value is 15, so this would add considerable delay if it is not configured for the correct CPU Clock rate.

    Best,

    Matthew