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.
Tool/software: Code Composer Studio
Dear All,
I am trying to work with tm4c1294ncpdt ethernet example enet_io. This whole example is working find. Sending data from web browser to uart is working fine.
Next I want to send data from tiva and display it on the webpage. Are there any example on that or any reference on how it can be done. What modification should I do in webpage and enet_io(Tiva code) to achieve this. Please help me if any one has any idea on how to do so.
Thanks
Aman.
Hi,
I'm not clear with your question about displaying on the webpage. The enet_io and enet_lwip are the web server examples. If you run the enet_io, you should be able to see the web page displayed on your browser hosted by the the tiva device. Isn't this what you are looking for. The example will display the below wepage if you type the Tiva's (the webserver) IP address on your broswer's URL field. The example will display on your terminal window on what IP address the Tiva (the web server) device acquires from the DHCP server. In my case, my Tiva acquires 10.219.14.134 as the IP address.
Dear Charles,
Thanks for your reply..
Here I am explaining what I want to do. See the last page "I/O control Demo 2(SSI/CGI)". On this page there is a box to send a string (max. 40char) to UART. So If you type send text that text will be sent out via UART0. Now I am connection a UART interface device to UART0 and send a command via web page and I want to display the reply from UART device to the webpage. For simple example I am trying to connect an ESP8266 that is interfaced via UART and send an AT command to ESP. If I send "AT\n\r" from webpage ESP will reply "OK\n\r" to UART0. Now I want this response to see directly on the web page.
1) If I type "AT" and then click "Send Text" command will goes to ESP.
2) There will be another box for the response of the ESP and in this Box reply form the ESP will be displayed(Eg. "OK" in response of "AT").
I can make a box in "io_cgi.ssi" file next to send Text box. But I don't know how to set the reply text form ESP to the box. Any help will be appreciated.
Thanks & Regards,
Aman
Hi Aman,
I think I understand what you are looking for. While I'm not an expert at all, I will point you to some code for you to reference and hopefully you get some idea to how to approach this. What you can reference is actually part of the enet_io example in my opinion. If you look at the I/O Control Demo2 (SSI/CGI) you may have already played with the animation speed. See below. You can type a new speed to change the LED blinking rate under the 'New' column. Once the new parameter is entered, the web server will update the new value under the 'Current' column. I will suppose this to be very similar to what you are looking for. For example, if you type a string in the field for Display this text over the UART: The string is sent to the web server. The web server will process this string (i.e. you type AT). The 'AT' string will then be sent to your ESP. When you ESP returns the 'OK' response or whatever response you will just use the same method the new animation speed rate is being sent by the web server to the browser.
Below is the description for IO Control Demo 2:
//! ``IO Control Demo 2'' uses standard HTML forms to pass parameters to CGI
//! (Common Gateway Interface) handlers running on the board. These handlers
//! process the form data and control the animation and LED as requested before
//! sending a response page (in this case, the original form) back to the
//! browser. The application registers the names and handlers for each of its
//! CGIs with the HTTPD server during initialization and the server calls
//! these handlers after parsing URL parameters each time one of the CGI URLs
//! is requested.
//!
//! Information on the state of the various controls in the second demo is
//! inserted into the served HTML using SSI (Server Side Include) tags which
//! are parsed by the HTTPD server in the application. As with the CGI
//! handlers, the application registers its list of SSI tags and a handler
//! function with the web server during initialization and this handler is
//! called whenever any registered tag is found in a .shtml, .ssi, .shtm or
//! .xml file being served to the browser.
//!
The handler that is talked about in the above description can be found in the enet_io.c. Please look at the ControlCGIHandler() and the SetTextCGIHandler() handlers.
Hopefully this is enough for you to start. If you get it to work, would you please share with the community so others looking for the same solution will also benefit.
Hello Charles,
As your two responses indicate here - 'Attention to Detail' is (consistently) required for poster's, 'Achieving his stated goal.'
That said - it is (instead) 'attention-deficit' which is far more noted! ''Wabpage' is ''disturbingly highlighted' w/in poster's Subject Line! Poster's initial post (may) be easily edited (especially the Subject LIne) (to) 'WEBPAGE' - and such 'disciplined attention' raises the poster's 'Odds of Success.'
It is doubted that the 'continued presence' of 'Wabpage' will, 'Drive many future readers' to so 'suspect' (glaringly uncaring/uncorrected) a thread... (Young (and older) staff here are unanimous in this belief...)
[edit] 21:34 CST (back now from the treadmill ... Thanks to he/she (likely T.I.'er) who made the correction. Some here 'care' about this forum - and to 'repeatedly' view so obvious an error ... seems highly inconsistent w/the forum's pursuit of excellence! Some will say 'big-deal' ... let them 'miss or misplace' a single ';' that too proves 'minor' - does it not? (pay no attention to the (likely) 10K+ errors - suddenly unleashed!)
TAG: Attention to Detail is important - at times - profoundly so!
Dear Charls,
Thanks for your reply.
I did it using the SSI handler. Here is modification in the code.
1) Replace the settxt.cgi table in "io_cgi.ssi" file. here is the html code.
<table align="center" border="1" cellpadding="2" cellspacing="2" width="80%"> <tbody> <tr> <td align="left" valign="top"> <form method="get" action="settxt.cgi" name="settxt"> <table border="0" cellpadding="2" cellspacing="2" width="100%"> <tbody> <tr align="left"> <td valign="top"> <b>Display this text over the UART:<br></b> <input maxlength="40" size="40" name="DispText"> <input name="Display" value="Send Text" type="submit"> </td> <td valign="top" align="center"> <b>Received Text From UART:<br></b> <table border = "1" width = "500" height = "35" align="right"> <tr> <td><!--#UARTtxt--></td> </tr> </table> </td> </tr> </tbody> </table> </form> </td> </tr> </tbody> </table>
The new page looks like this,
run command in the code directory to generate "io_fsdata.h" after change in .ssi file.
makefsfile -i fs -o io_fsdata.h -r -h -q
2) In "enet_io.c" file add the SSI tag name to *g_pcConfigSSITags[]. And also define SSI_UART_REPLY
#define SSI_UART_REPLY 3
static const char *g_pcConfigSSITags[] = { "LEDtxt", // SSI_INDEX_LEDSTATE "FormVars", // SSI_INDEX_FORMVARS "speed", // SSI_INDEX_SPEED "UARTtxt" // SSI_UART_REPLY };
3) In the same file add in SSIHandler function add and iIndex case.
case SSI_UART_REPLY: usnprintf(pcInsert, iInsertLen, RxBuf); break;
My Rxbuf[] array contains the reply for the uart devices. This will send the data to webpage every time you send a command from Send Text.
Hi Aman,
Thank you for sharing the code. I will bookmark your answer and reference it to others in the future.