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.

Using TMS570LS20216 NHET Module to shift out 32/64 bits at 2 MHz

Other Parts Discussed in Thread: TMS570LS20216

Hi there,

Just before I dig further, by assuming that the NHET is clocked at a frequency capable of achieving a loop resolution lr<500 ns (2 MHz), could anyone tell me whether it is possible to use the TMS570LS20216 NHET Module to shift out up to 64 bits at 2 MHz using a given NHET function pin?

I noticed that there are only 3 registers A, B and T in this module, and don't know how to work with variables and shifting within the NHET.

Thank you.

  • Hi Chuck,

    The NHET doesn’t support 64-bit writes. Please refer to the following thread:

    http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/69800/253668.aspx#253668

    Regards,

    QJ

  • QJ,

    This is not I'm asking.

    I would like to know whether it is possible to shift-out a variable or at least, a register of a given bits (let say 32-bit), at 2 MHz to ONE single NHET pin, I mean, one bit at a time/per loop resolution.

    What if I have 64 bits? Can I dynamically change the register contents after the first 32 bits have been shifted-out?

    If so, can you provide example, sample source code or suggest NHET instructions for doing such operation?

    Thanks,

    Chuck.

  • So yes it is possible to do what I want to do, except that I've encountered problem or misunderstand how the SHFT instruction works.

    I use the following NHET program to shift out 8x registers of 25-bits each, as 25 bits is the max data field size for the SHFT instruction. However, as shown in the figure I obtain some inconsistencies in the output and can't understand why. Between the first register 0x01C0799 and the second register 0x11C38CC, I got an extra '0' bit. Between the second register 0x11C38CC and the third register 0x1E03807, there is a missing '0' bit, and so on ...

    Please shed some light anyone?

     

    L00 CNT     { next=L01, reg=A, max=0x01FFFFFF }
    L01 SHFT    { next=L00, pin=CC6, smode=OL0, cond=UNC, cond_addr=L02, data=0x01C0799 }

    L02 MOV64   { next=L00, remote=L01, pin=CC6, cond_addr=L03, data=0x11C38CC, reg=NONE, comp_mode=ECMP }
    L03 MOV64   { next=L00, remote=L01, pin=CC6, cond_addr=L04, data=0x1E03807, reg=NONE, comp_mode=ECMP }
    L04 MOV64   { next=L00, remote=L01, pin=CC6, cond_addr=L05, data=0x003CCF3, reg=NONE, comp_mode=ECMP }
    L05 MOV64   { next=L00, remote=L01, pin=CC6, cond_addr=L06, data=0x0783870, reg=NONE, comp_mode=ECMP }
    L06 MOV64   { next=L00, remote=L01, pin=CC6, cond_addr=L07, data=0x03CCF33, reg=NONE, comp_mode=ECMP }
    L07 MOV64   { next=L00, remote=L01, pin=CC6, cond_addr=L08, data=0x180E000, reg=NONE, comp_mode=ECMP }
    L08 MOV64   { next=L00, remote=L01, pin=CC6, cond_addr=L08, data=0x0000000, reg=NONE, comp_mode=ECMP }

  • OK, the real question is: why the SHFT instruction jumps to the conditional address when its data field is all "1" or all "0" (25 bits)?

    As such, it can never shift out all 25 bits of data field because sooner or later, it will jump before the end of the 25 shifts, simply because any number will terminate by either an "1" or a "0".

    Please clarify.

     

  • Anyone on this one? Please ...

    Additional to the above post, I am looking for the answers to the following questions:

    Can I configure the NHET to shift out exactly 25 bits from the data field, all the time, regardless whether there are "0" and/or "1"?

    I have observed that, since I use "smode=OL0", NHET left-shifts out msb and right-fills with "0". Once the last "1" in the 25-bit data fields (not all 25 bits if one or more lsb are "0") is shifted-out, an additional "0" bit is shifted out before conditional jump. How can I prevent this additional "0" in the output?

    I need to understand those NHET behaviors because I use the NHET to shift out a controlled number of bits with exact timing (500 ns/bit).

    Thank you for coming back to me.

  • Hi Chuck,

    For your first question of cond jump on all 0's or all 1's, yes, it is the intent of the shift instruction.  you can see the micro-code description on page 1382 of the TRM.

    Reason is that the shift instruction will also result into either shift in 0 or 1 to shift register when shift instruction is executed, thus, when all 0's or all 1's it means the shift is done for this data.

    For your second question on continuing to shift data out when data is all 1's and all 0's, unfortunately the shift instruction does not allow this.  It will jump to conditional address because it thinks that all data has been shifted out.  can i ask why you want to shift out all 1's or all 0's?  Is it to control the CS and SPICLK when you are done with SPI transfer shifting? If this is the case, there is a way to handle this.  Please see attached picture that show the result that i am able to drive SPICLK low and CS high after 4 consecutive SPI transfers were done.  if this is what you want to do, i can send you the example codes.

    Best Regards,

    Henry Nguyen

  • Hi Chuck,

    since you are doing SPI, i have a small example on how to emulate SPI using NHET. 

    See attachment for the complete SPI example codes and associated HET IDE project.

    This SPI codes are set to do 4 transfers (but you can change it to whatever number of transfer that you want to do if you follow the same structures).

    It inserts delay from CS low to SPICLK active high for each transfer.  You can control this by changing the data field in WAIT symbol.

    I put comments into codes on how to start and restart the next 4 SPI transfer as well as setting up new data for next 4 SPI transfers.

    I hope this helps.

    Best Regards,

    Henry Nguyen

    forum_2_shift.zip
  • Hi Henry,

    Thank you for your suggestion on the SPI example using the NHET. For my use, the 3 built-in SPI are enough for the purpose. Rather I want to use the NHET to shift out a simulator Manchester encoded data stream to our hardware Manchester decoder for loopback testing purpose. As such we have to control the number of bits at the exact timing, and exact bits patterns.

    Given this SHFT instruction limitation or "feature" is you want to call :), I manage to do it anyway. For this, I have to carefully partition the desired output data stream by breaking always between an "1" and a "0", so when the SHFT shifts out the last one, it will insert a zero on the next NHET loop, so I have to start the next data field without the "0" of my bit stream.

    For example, if I have to shift out "xxxxxxxxxxx1001xxxx", I have to break it as follow: first data field contains "xxxxxxxxxxx1", after this is done, the data field have to be updated with "01xxxx" because the first zero is inserted by the SHFT instruction.

    I still don't understand why the SHFT was designed this way, why not just clock out 25 bit, any value then stop? For what application was it designed for?

    Not really looking for an answer but just curious though ...

    Thanks again Henry.

  • Hi Chuck,

    the SHFT instruction was designed as a self-counting instruction when shifting out or in data.

    when all 25-bit data is shifted in or out (all 1 or all 0), then it can branch to conditional address to either move data into internal buffer for shift in case or reload new shift out data.  This can be done without a CNT instruction.

    to get around the feature, one can implement a CNT instructions as:

    CNT (from 0 to whatever number, e.g. 25)

    BR (event=z, cond_addr=reload or move to buffer, next=shift)

        shift (in or out, cond_addr = next address = to CNT )

    this way, even if your data field is 0 or 1, it will shift 25 times according to your protocol.

    i hope this can be helpful.

        

  • Hi Henry,

    For sure that helps! This twist address the shortcoming of the SHFT instruction. ;)

    Thanks again.