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.

GPIO High during interrupt based sending over UART

Other Parts Discussed in Thread: HALCOGEN

hi,

we are using the tms570  together with the RS485 transceiver where we have to indicate wether we are sending or receiving. Therefor we have to set a GPIO to high/low during sending and receiving. Since we have to use the interrupt routines to avoid blocking of the processor we would like to know if there is a way to combine a toggling of a pin with the interrupt routine during sending.


Kind regards,

C.W.

  • C.W,

    You can generate GIO driver for your device from Halcogen.

    Look at the gio.c and you can use the gioSetPort function to set 0 or 1 on your GIO port.

    Look at the gio.h for syntax.

    Hope this helps you.

  • Ok this does not answer my question. As I mentioned I would like to toggle a enable pin durnig transmit. But if the transmit is done using interrupts it is a bit harder to do. How does the interrupt know, that the byte has been transmitted without polling?

    kind regards,


    C.W.

  • C.W.,

    Ok, sounds like your current concern is a bit different with original concern.  From reading your original question, sounds like you would like to know how to toggle GIO pin during an interrupt service routine during transmission.  

    "...we have to set a GPIO to high/low during sending and receiving. Since we have to use the interrupt routines to avoid blocking of the processor we would like to know if there is a way to combine a toggling of a pin with the interrupt routine during sending"

    Now, your question seems to be different.  

    So, let's start with the first question.  By looking into GIO .c and .h file generated from Halcogen, do you know how to toggle a GIO pin yet?  Is it clear to you?

    Now, on the second question above, I assume that you are using SCI module to do the TX / RX with the HALF-DUPLEX mode because you want to use RS485.  If i remember correctly, RS485 CAN NOT do full duplex at the same time.

    The SCI will generate the TX interrupt to VIM after copying the content from SCITD to the shift register SCITXSHF.  This will allow user to write a new transmit value to the SCITD and toggle GIO.  when both SCITD and SCITXSHF registers are empty, then, TX EMPTY status bit will be set.  This is to let you know that the transmission has completed.  Unfortunately, there is no interrupt generation when TX EMPTY is set.  I would suggest that you use RTI to trigger an interrupt once you know how long it will take to empty the SCITXSHF register to avoid polling TX EMPTY flag after writing to SCITD.  So the sequence will be.

    1- wait for interrupt.

    2- Check to make sure TXRDY is set.  

    3- toggle GIO to indicate to RS-485 that you are about to transmit and enable TX mode.  Disable RX mode.

    4- Write to SCITD.

    5- Set RTI timer interrupt.

    6- exit.

    On RTI interrupt, poll for TX EMPTY bit.  Then, toggle GIO pin.  Enable RX mode.

    I hope this helps.