Post Go back to editing

Modify UART Echo Back

I have reviewed the UART Echo Back code and searched the forum for this question, but didn't find an answer.

How do I use the UART Echo Back code to get several answers from the user.

    for example;  (1) xmitUARTmessage sends message to user

                          (2) user responds with one of the choices

                          (3) repeat steps 1 and 2 to get all configuration data 

    

   Press 1 to calculate area of circle

   Press 2 to calculate area of square

   Enter your choice

   123456789hvcxvvxsdfxszcgbnhjjmnmb xchn,kbghvcxzcjhn,

   Need to stop ISR, transmit another message and get the response.

  • Hi,

    Can you please confirm which processor you are using? It would also be helpful if you can share which example code you are referring to?

    Regards,
    Anand Selvaraj.

  • I am using the UART Echo Back code for the ADSP-21489 Ez-kit.

    Dan

  • Hi,

    Thanks for your reply. Were you able to get the code working as it is? Can you let me know what you have modified in the code?

    Regards,
    Anand Selvaraj.

  • Hi,

    Yes, the original UART Echo Back code works. I need the user to enter choices on the

    Tera Term. for example

    Message to user  

       Press 1 to calculate area of circle

       Press 2 to calculate area of square

       Enter your choice

    The code needs to read the user response and continue executing.

    My question is can this be done with ISR or do I use the polling method. Explain which option is better with brief example.

    Dan

  • Hi,

    Apologies for the delayed response.

    The major difference between the core mode and DMA mode is that in core mode the core does the data transfers. For DMA mode, the DMA controller takes care of this.

    The UART echo back example code uses core mode operation because each data word received from PC should be sent back immediately. Using the DMA mode may not be a good idea for this case. If you want to use DMA mode then you may need to send one set of data from the PC end. On the DSP end receive all of them in DMA mode and send them back.

    Moreover, I would suggest you to verify if the baud rate at the DSP and PC matches correctly. Are you making sure that the UART settings (no of data, parity, stop bits, baud rate) are exactly the same on both DSP and PC ? Also, what do you see when you probe the UART_TX signal ? Do you see everything okay there?

    Regards,
    Anand Selvaraj.