|
![]() MCU User Forum
![]() Data Logger using CP2201 EB
|
| next newest topic | next oldest topic |
| Author | Topic: Data Logger using CP2201 EB |
|
nikhilmuley7 Member |
hi, i am developing a application (data logger) using CP2201 EB the aim of the project is to generate a text file which take the samples at 1sec interval when i hit ipaddress of embedded server. so for the initial stage i am using the code provided with the Kit. I am finding problem to modify CGI script. my first question is is this possible? thank you IP: Logged |
|
Tsuneo Member |
> I am finding problem to modify CGI script. For pure CGI, the embedded server has to make up entire web page. It's heavy for the embedded server with limited resources. I recommend you to apply Javascript and XMLHttpRequest on the browser side. In this approach, embedded server provides just the data over CGI. Browser requests the data to the server, and it redraws the display. Visit to this post for the details. Dynamic HTML using JavaScript, DOM and XMLHttpRequest (= Ajax?) To run the refresh function every 1 second on Javascript, <body onload="your_refresh_function()">
If you need more periodic data sampling, Tsuneo [This message has been edited by Tsuneo (edited August 03, 2010).] IP: Logged |
|
nikhilmuley7 Member |
Tsuneo, thanks for guiding me again. in my opinion you are the best person who has solution for every problem. as i searched the forum i found taht you have helped each and every people.i think because of people like you this forum is alive. if i stuck at some point i will let you know ..... thanks again, [This message has been edited by nikhilmuley7 (edited August 03, 2010).] [This message has been edited by nikhilmuley7 (edited August 04, 2010).] IP: Logged |
|
nikhilmuley7 Member |
hi, CGI script is a new concept for me so when read the post "Dynamic HTML using JavaScript, DOM and XMLHttpRequest (= Ajax?)". i thought that the example 1 provided in this post should be good starting point. scince i have only CP2201 EK kit.so i have done following modification in example 1 .i took the following steps: first i generate the project using TCP/IP configuration wizard ticking the content {8051f340,cp220x,http,tcp,ethernet} and in second step i followed the guideline provided in post "what to modify for the CP2201-EK " .......... than i load the hex file in kit.but it wont work.................. ping is also not working ...............cable is ok ........... i think that i am missing some thing ......... what ????????????????????? if any body knows how to modify program to work with CP2201 eb from strach. Tsuneo your suggestion/comments are valauble to me. thanks
[This message has been edited by nikhilmuley7 (edited August 04, 2010).] IP: Logged |
|
Tsuneo Member |
> first i generate the project using TCP/IP configuration wizard ticking the content {8051f340,cp220x,http,tcp,ethernet} Maybe, you would miss to change some parameters on TCP/IP config wizard. As of TCP/IP config wizard, Compare mn_userconst.h of yours and the downloaded one using "diff" utility, like WinMerge. And then, you'll identify the parameter difference on the wizard. WinMerge Tsuneo [This message has been edited by Tsuneo (edited August 04, 2010).] IP: Logged |
|
nikhilmuley7 Member |
Tsuneo, it worked........ as you said i done the same thing with "F340_CGI_DHTML.wsp" and after modification i downloaded the hex file.the project is working fine. .....now i am finding error in my project comparing with F340_CGI_DHTML.wsp using utility winmerge. thanks, IP: Logged |
|
nikhilmuley7 Member |
Tsuneo, hi ......... i am now moving further the previous problem was sort out. now i am implementing html page to see the temp data on webpage so i refered "CP2201EK_AB4_STD" example ........ while compiling i got this error "*** ERROR C200 IN LINE 488 OF MAIN.C: left side of '.' requires struct/union" is that mean that i have to define structure ........... i dont think so...? thanks, IP: Logged |
|
Tsuneo Member |
Umm.. LINE 488 OF CP2201EK_AB4_STD\MAIN.C is
I can't realize why the error occurs here, just seeing the source code. So, I compiled the example for confirmation. Found that the project sets the tool chain as a mixture of full and eval, 'Project' menu > Tool chain integration Fixed it and I got compile/link without any error. Tsuneo IP: Logged |
|
nikhilmuley7 Member |
Tsuneo, you said it correctly i have keil full and eval versoin supplied by silab both installed. but the error "*** ERROR C200 IN LINE 488 OF MAIN.C: left side of '.' requires struct/union" was on this line. given below "sprintf(HTML_BUFFER, " i have also checked tool chain setting. i have given correct path. sorry the above content are missing because of html tag: thanks, [This message has been edited by nikhilmuley7 (edited August 08, 2010).] [This message has been edited by nikhilmuley7 (edited August 08, 2010).] IP: Logged |
|
Tsuneo Member |
Is this line? C:\SiLabs\MCU\Examples\C8051F34x\Ethernet\CP2201EK_SOURCE\CP2201EK_AB4_STD\main.c void get_data(PSOCKET_INFO socket_ptr) cmx_reentrant {
Tsuneo IP: Logged |
|
nikhilmuley7 Member |
Tsuneo, you are right when i compile original example it dosent give any error.the orginal source code is fully functional. i have only remove/commented the (telnet, dhcp, netfinder, LED blink)in main.c keeping only html server working.i donot touch other files i have only done modification in main .c i think that "HTML_BUFFER" is causing the problem. when i commented spintf line the code dosent give any error. now i am pasting the main.c that i have modified errrrrrrrr
some how i manage to edit this post. how can i upload here zip file?
[This message has been edited by nikhilmuley7 (edited August 09, 2010).] IP: Logged |
|
Tsuneo Member |
> how can i upload here zip file? Unfortunately, this forum doesn't accept zip file attached. a) Your internet provider may offer free space for your home page. b) 8052.com offers 512KB free space for you, after registration. CREATE 8052.COM ACCOUNT c) Free file share servers on the internet. etc. Tsuneo IP: Logged |
|
nikhilmuley7 Member |
Tsuneo, hi again, i have uploaded the project. below is the link. http://www.8052.com/users/zip/test.zip what i am trying to do here is to read temperature and light data and display it using html server. i think the problem is in web2.h please give more insight on above line. thanks, [This message has been edited by nikhilmuley7 (edited August 09, 2010).] IP: Logged |
|
Tsuneo Member |
> i think the problem is in web2.h > "#define HTML_BUFFER dhcp_info.sname" Ya. Make a global byte array for HTML_BUFFER, instead of dhcp_info.sname. Tune its size so as to fit to the greatest among three sprintf's format. Tsuneo [This message has been edited by Tsuneo (edited August 09, 2010).] IP: Logged |
|
nikhilmuley7 Member |
hi Tsuneo, i have made global byte array for HTML_BUFFER and it worked. thanks again, now in the project i am adding 2 more virtual files.one for light intensity and another for control pannel ie two switches. thanks, IP: Logged |
|
Tsuneo Member |
> now in the project i am adding 2 more virtual files.one for light intensity and another for control pannel ie two switches. what care should i take so that memory usuage should not exceed the limt for "cp2201ek". Virtual files go to the code memory (63KB) of the 'F340 on the CP2201EK. Tsuneo IP: Logged |
|
nikhilmuley7 Member |
hi Tsuneo, of course the Virtual files go to the code memory (63KB)which is not a problem. my point to ask memory management is that how to modify the program so that multi user can access the data at same time. in our project it should not be more than 5 person. thanks,
IP: Logged |
|
Tsuneo Member |
> my point to ask memory management is that how to modify the program so that multi user can access the data at same time. in our project it should not be more than 5 person. For five or so over LAN, this embedded HTML (web) server will work smoothly, though it supports just single connection at a time. But when the users access to the server over internet of slow speed, the server connection is occupied so long while it serves one user. Also, even over LAN, too many users (a couple of tens) will suffer from delay of the service. In these cases, the HTML server should support mutiple connections at a time. Unfortunately, this TCP/IP stack doesn't support multiple connections of HTML server, mainly because of limited resource of the MCU. If it is the case, move to 32bit MCU. For simple TCP server, instead of HTML server, the stack can keep track over multiple connections at a time. tcp server: How to listen the port Socket time out Tsuneo [This message has been edited by Tsuneo (edited August 11, 2010).] IP: Logged |
|
nikhilmuley7 Member |
Tsuneo, thanks for valuable information. regards, [This message has been edited by nikhilmuley7 (edited August 13, 2010).] IP: Logged |
|
nikhilmuley7 Member |
hi, i dont think this is right forum to put this question?.............. but some body interested should help me.
this stack will be implemented in cp2201ek. thanks in advance IP: Logged |
|
Tsuneo Member |
> i am planning out to build a embedded tcp/ip stack from scratch with feature of multiuser interface. You don't need to make it from scratch. Make it on uIP. uIP uIP implementation on CP2201EK for SDCC, by Maarten (vanmierlo) Tsuneo IP: Logged |
|
nikhilmuley7 Member |
hi Tsuneo, uIP implementation on CP2201EK for SDCC, by Maarten is an interesting project and good way to learn/understand uip.
IP: Logged |
|
nikhilmuley7 Member |
hi, when i open uip project it say that "locate main.mem and main.map" i am unable to find those files. dose any body know where to find ?
IP: Logged |
|
apemberton Member |
Those files are generated by SDCC and if the project hasn't been built yet, don't worry, just ignore it. You may need to modify the project parameters to suit your needs, especially if using a different compiler. The .mem and .map files show the memory usage and the linked object and are very useful (with SDCC) for finding out where things have been placed. For example, I found that passing parameters to the 'sprintf' function gobbled 'data' and 'idata' memory and caused me to break up the parameters passed so that 'sprinf' reused precious memory bytes.
------------------ IP: Logged |
|
nikhilmuley7 Member |
hi Tony, thanks for your response.i will try to build the project. thanks, IP: Logged |
|
nikhilmuley7 Member |
hi, when i build the project it gives an error
C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>rem cd "C:\Program files\SDCC\source\embedded_ethernet_complete_code\CP2200\ C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -v C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>rem SDCC -c --debug --model-large --std-sdcc99 _startup.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>rem copy _startup.rel "C:\Program files\SDCC\lib\large\_startup.rel C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>rem copy _startup.asm "C:\Program files\SDCC\lib\large\_startup.asm C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm main.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm Flash.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm CP2200.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm config.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm uip\uip.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm uip\uip_arp.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm uip\uip_arch.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm apps\dhcpc\dhcpc.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm apps\sntp\sntp.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm apps\httpd\httpd.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm apps\httpd\cgi.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm apps\httpd\fsdata.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm apps\httpd\fs.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm apps\telnetd\telnetd.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm IUart.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm IET_temp.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6\apps\httpd>SDCC --debug --model-large --code-size 0xF800 --xram-size 0x0f80 main.rel uip_arp.rel uip_arch.rel uip.rel CP2200.rel Flash.rel dhcpc.rel sntp.rel httpd.rel cgi.rel fsdata.rel fs.rel telnetd.rel IUart.rel IET_temp.rel config.rel IP: Logged |
|
apemberton Member |
I assume you are trying to use the SDCC compiler but it seems that the IDE cannot find the right path to the compiler or linker. I have the feeling that you havn't configured the IDE for SDCC or SDCC itself is not configured properly. What happens if you open a command prompt window and type 'sdcc --version'? Does it return the SDCC version number? Mine displays:- SDCC : mcs51/gbz80/z80/ds390/pic16/pic14/TININative/ds400/hc08 2.9.7 #5873 (Jul 6 2010) (MINGW32) If not, reinstall SDCC. If you do get a good version, SDCC must be configured in the IDE from the 'project' - 'tool chain integration' menu. I believe there is a Silabs Application Note (the number escapes me right now) describing SDCC integration. Have fun ------------------ IP: Logged |
|
nikhilmuley7 Member |
hi, you are wright sdcc is not installed properly .... it is not showing the version thanks, IP: Logged |
|
nikhilmuley7 Member |
hi, i am new to sdcc compiler what i have done here is i interface it with silab ide ...... for uip project. is there any more changes to do? ..... ........... ..... when i comile it gives following error.. C:\SiLabs\MCU\Examples\my_demo\one\my_test_6>SDCC -c --debug --model-large --std-sdcc99 --fverbose-asm Flash.c C:\SiLabs\MCU\Examples\my_demo\one\my_test_6>SDCC --debug --model-large --code-size 0xF800 --xram-size 0x0f80 main.rel uip_arp.rel uip_arch.rel uip.rel CP2200.rel Flash.rel dhcpc.rel sntp.rel httpd.rel cgi.rel fsdata.rel fs.rel telnetd.rel IUart.rel IET_temp.rel config.rel IP: Logged |
|
apemberton Member |
SDCC is nowadays very picky (as it should be) about data types. As I know the uIP code was originally built for a less restrictive exchange of data types, the source is probably in need of updating. Unfortunately I cannot see the last message with the precise error. If I remember correctly it looks as if data type on the right is a code/const flash mem pointer and the left is an integer pointer. Casting from right to left needs the correct cast. Look carefully at the data types that are giving the error and cast the data type as appropriate. ------------------ IP: Logged |
|
nikhilmuley7 Member |
hi, please can you guide me how to do correct cast ...... i will try but still i need your help. thanks for helping, IP: Logged |
|
nikhilmuley7 Member |
hi , are you the same guy who has modified code of uip to run in cp2201ek.yesterday just while reading (understanding) the code i saw the name of author it is written there "A.Pemberton" and you are "Tony Pemberton" ... ....... .......... ... usually i ignore the starting comments for saving time.if you are the same guy "hatsoff" to you work. if you have some nice tutorials about uip can you provide me? thanks, IP: Logged |
|
apemberton Member |
Yes, I did a conversion of uIP 0.9 for SDCC and the C8051F120/AB4 (Ethernet DK) some years ago. (That was in turn developed from a module using the C8051F020/Davicom DM9000E.) Maarten's version was adapted for the Ethernet EK (C8051F340/CP2201) and that is the publicly accessable on 8052.com - thanks Maarten. I am no longer working with uIP and am using ARM's for ethernet stuff. As for type casting, methodology should be available in a 'C' manual of choice. You should be able to see what you have to cast from and to from the error messages. It helps (for me) to try and imagine the type of physical memory that is being used on the left and right side of the equation. The error message shows passing of a pointer from one type to another. I can't tell you what would put that right. ETA: I used the uIP manual from the uIP site. Quite comprehensive but necessarily thare has to be small modifications to suit 8051/SDCC. ------------------ [This message has been edited by apemberton (edited September 22, 2010).] IP: Logged |
|
nikhilmuley7 Member |
hi, do you have Maarten's version source code .... because i have to use it in cp2201 -EK thanks for your guidance, IP: Logged |
|
England90 New Member |
Thanks for sharing this information! ------------------ IP: Logged |
|
erikm Member |
please do not post such in old threads you have not initiated, it leads to unnecessary views Erik IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
Have you seen our MCU Knowledge Base?