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.

Halcogen SPI driver stuck in infinite loop

Other Parts Discussed in Thread: HALCOGEN

I'm using the Hercules TMS570LS0332 and TPS65381 running in QA mode. I'm able to communicate with and initialize the TPS chip and verify that I am in the Diagnostic state. I want to service the watchdog until the fail count reaches 0 and move to the Active state.

I find that when I am trying to answer send the tps watchdog answer the Halcogen spi driver gets stuck in an infinite loop where it looks like it's waiting for the RXINT bit to be set, see code below. I've looked at the SPI signals with an oscilloscope and have attached the results. The last command I send is the 0xE10F command and then get stuck in the while loop below. Any ideas why I'm getting stuck in this loop?

  /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Hardware status bit read check" */
        while((spi->FLG & 0x00000100U) != 0x00000100U)
        {
        	
        } /* Wait */

  • The code is waiting for the receive interrupt flag. This flag is cleared by reading the receive buffer, writing a one to this flag bit or disabling the SPI. A read-modify write operation on this register could clear this flag. Did your code properly read the 0xA0000?
  • The code does properly read the 0xA000. The next command should be 0xA500 and this is where the spi code gets stuck in a loop waiting for the receive interrupt flag. I don't see the 0xA500 with the scope so it seems it's not written correctly but the spi code writes it and then waits for the receive interrupt flag. 

    The Halcogen generated code does have this check before performing the write, but I have verified that I'm not hitting that line. Any ideas why the write does not seem to be occurring yet the code is waiting for RXINT?

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

  • Can you provide the code you wrote that calls the HALCoGen functions. I think that somewhere the RX INT flag got cleared somewhere in the code.
  • The location in code where I see the problem occur is in the module tpsWatchdog.c, the function is sendTpsAns. I call TPS_SendWdgResponse 4 times sequentially. The screenshot I included earlier shows the sequence, the first call to TPS_SendWdgResponse sends the E1FF and A500 command, the 2nd call to TPS_SendWdgResponse sends the E10F command, reads the A000 and then I get stuck waiting for the RXINT.4452.Runtime.zip

  • Bob, Did you find anyplace where the RX INT flag was getting cleared? I've been investigating this and it seems as if the 'A000' in the screenshot is not read although it does appear on the bus. Any ideas why this would happen?