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 N2HET pins for UART communication

Other Parts Discussed in Thread: LM10

Greetings,

I need more serial ports on the RM48 and I was wondering if the N2HET pins can be configured for UART communication. I found an application note SPNA097 from June 2006 that presents a UART implementation using the High-End Timer on the TMS470. However I have not seen a similar application for the RM48/TMS570 MCUs. I haven't looked at the implementation closely yet, so at this point it is not clear to me if the sample HET code will work on the RM48 and how the code needs to be modified for the RM48's higher clock frequency.

Has anyone done this, can you provide some sample code for the RM48 ?

Thanks,

Marius

  • N2HET is slightly different from HET. The data field of N2HET is longer than HET. But it is not not difficult to translate it into N2HET.

    The code in the application note does not use the majority vote, it just samples once to determine the value. I am not sure this is what you want.

    What is the your baud rate? Any parity bits?

     

     

     

  • I would like to use the emulated UART for bi-directional communication to a PC terminal, so it has to support the typical PC baud rates: 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, and 115200, no parity, 8 data bits, 1 stop bit, no flow control.

    Thanks,

    Marius

  • I just got it working on my RM46 board.

    I didnot use the method in application note. I use majority vote in Rx mode.

    The project is not well documented. If you need it immediately, I can send to you. Or, if you can wait, I can spend some time to comment the code.

    Haixiao

  • I'm not in a rush, take as much time as you need to properly document the code. I really appreciate all your support.

    Thanks,

    Marius

  • 4137.HET_EMU_SCI.zip

    I plan to write sth - maybe a application note to address this, but this is not going to happen this year, so, I post the project with some comments.

    There is a HET_EMU_SCI.het file inside. It is the source file for N2HET.

    The CCS project provides both poll and interrupt for receive and transmit examples.

    The baud rate is 115.2 kbps, 8 data bits, 1 stop bit. The PLL runs at 192MHz. If you want to change the baudrate, you can:

    1. modify the HETPFR register to slow down the HET LRP

    2. modify the HET code itself and re-compile

    3. modify the pll frequency.

    Regards,

    Haixiao

  • I was able to port your example to the RM48 and verified that it works. I will probably have more questions when I dive into the het program, but right now I am marking this thread as verified.

  • Hello Haixiao,

    I think I have a good understanding now of how your UART emulation program works and what each HET instruction does. I was able to run bi-directional serial communication at various baud rates from 1200 to 115200 baud by changing the counter max values and the time slots at which we count bits for the voting scheme.

    Your program contains 34 instructions. I've been trying to find a way to reduce it to 32 instructions such that I could fit 5 instances of the program into the HET memory, in order to emulate 5 individual serial ports, but I was not successful. I tried simplifying the receive program architecture where instead of using a particular range of time slots for bit voting, I would count all high-pin time slots in the bit time using ECNT { event=ACCUHIGH } and all low-pin time slots using ECNT { event=ACCULOW } and compare the two counters at the end of the bit time to decide if the bit should be high or low, but I couldn't get my program to work.

    Do you see any way to get the program down to 32 instructions, either with your bit voting approach, or with my idea of comparing the total number of highs and lows ?

    Thanks,

    Marius

  • I use lots of "SUB, following by BR", they can actually be replaced with one ECMP or MCMP instruction. The Cons are: you have to assign a pin to MCMP/ECMP instruction and in one LRP, the MCMP/ECMP on this pin can not be executed once. That is: if you want to replace 2 instances, you need to have two pins.

    Since I have already use one of the Dummy_Pin, we can replace one of this with no cost, save one instruction. Then, for all the 5 instances of UART, they can share

    SCITX    CNT     { next= Lm10,  reg = T, max= 12, irq = OFF,data=0}
    Lm10     BR      { next= SCIRX, cond_addr= Lm11, event = ZERO}

    So, total instructions: 32*5 + 2 - 5 = 157.

    Another issue I did not check is that: in the current setup, it only allow less that 64 instructions to be executed in one LRP. I did not count the worse case if 5 instances are used. If it exceeds the limit, one workaround is to slow down the LRP, today, we 13 slots in one bit, if 8 is allowable, we can slow down the LRP and handle roughly 64 * 13 / 8 = 104 instructions. That should be enough for your use case.

    Regards,

    Haixiao

     

  • I like your idea of using ECMP or MCMP instructions for receive state branching, I will try that one. I am implementing this on the HET2 peripheral of the RM48 ZWT package which only has 18 physical pins, so I've got plenty of spare pins to use as dummies.

    I thought about using a single CNT instruction for SCITX on all 5 ports, but it is not going to work, because the serial ports may run at different baud rates.

    I don't think I have an issue with the number of instructions I can execute in one LRP because I set the VCLK2 frequency to 200 MHz, with a HR divider of 3 and LR divider of 64, so I should be able to execute up to 192 instructions in one LRP; therefore, I believe my only limitation is the HET RAM size.

    I'll try your first idea and let you know how it works.

    Thanks,

    Marius

  • How may I download the attached example project.  The following error is indicated when I try to download the file:

    403 - Forbidden: Access is denied.
    You do not have permission to view this directory or page using the credentials that you supplied.

    I am planning to use RM42 but it has only 1 SCI port.  Thus would like to have a reference implementation.

    Thanks,
    Jayanth

  • I don't why what happened. Sound like a problem after we merge three forums together.

    Send an email to haixiao.weng@ti.com, I will forward the project to you.

  • 6114.HET_EMU_SCI.zip

    Here I posted the project again. It includes a RM48 + a LS31 project.

    If you use RM42 or LS0x, please modify the pll frequency to half of it and set HCLK=VCLK.

    Regards,

    Haixiao

  • Downloaded the file.

    Thanks,
    Jayanth

  • I would like to download the attached ZIP file but I get 

    You do not have permission to view this directory or page using the credentials that you supplied.

    Do i need to join a special forum group? I am  member of the TI and I signed in. 

    NOTE:  Sorry new to E2E. fJust saw the thread down here and was able to download. Will be using it on the RM42 thanks about the extra notes: "If you use RM42 or LS0x, please modify the pll frequency to half of it and set HCLK=VCLK."

  • Please go to http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/295723.aspx

    to download it.

    I have the same problem to access this attachment AFTER several forums merges into this forum.

    Regards,

    Haixiao

  • Hi,
    Am not able to open HET project. Can you share the HET project file?
  • I can not download the code either. I get "You do not have permission to view this directory or page." I am logged in, can you tell me what I an doing wrong?
  • 7041.N2HET_EMU_I2C.ZIP7838.N2HET_EMU_I2C_AppNote.pdf7624.HET_EMU_SCI.ZIP2161.N2HET_EMU_SCI_AppNote.pdfAs Haixiao mentioned above, the link was lost during various merges and updates to the ESE database and as an alternative you can go to this thread and get the files .

    This has nothing to do with you credentials or access as I cannot get to them either. For simplicity, here are the zip files and tentative application notes for both SCI and I2C N2HET drivers.