Spinneret code almost working?
AKruzel
Posts: 25
Hello all,
Ive been working on writing my own code for the spinneret and Im feeling very close to achieving my goal of reading data sent from web browser after I type my IP address into the web browser and establish a socket. After reading the data in the RX memory successfully, Im trying to send a string from the propeller to the web browser and having it appear on the screen but Im not getting it to work. Not sure where Im going wrong.
Heres a simple list of instructions for using my code. This is what Im doing so perhaps Im approaching this the wrong way?:
1. Change IP address, MAC address, etc to fit to your spinneret. Youll see these in the INIT function of my code
2. Program it into propeller using prop plug on spinneret
3. The program will go ahead and initialize the common registers and then will prompt you to hit W for write, R for Read, Z for reset or E for Exit. This is meant to be a LIVE interface so I can quickly write and read certain registers using the terminal. Just hit E for exit for now and it will go through setting the mode for the socket, etc and setting it to listen.
4. Type in the IP address with the necessary port (I have port set as 5555 in my code) into your web browser and try to connect
5. The terminal should now be prompting you to make another selection of typing, W,R,Z or E. Type E and it will go through establishing the socket and reading data from the RX memory.
6. This is the part thats tripping me up. After reading the memory, I want it to write a string back to the web server and have it appear on the screen. Not sure if its something I have written incorrectly in the string or the sequence and timing of the SEND, DISCON and then CLOSE commands.
I appreciate anyone wholl take the time to test this out and see where I may be going wrong!
[FONT="]Thanks,[/FONT]
Ive been working on writing my own code for the spinneret and Im feeling very close to achieving my goal of reading data sent from web browser after I type my IP address into the web browser and establish a socket. After reading the data in the RX memory successfully, Im trying to send a string from the propeller to the web browser and having it appear on the screen but Im not getting it to work. Not sure where Im going wrong.
Heres a simple list of instructions for using my code. This is what Im doing so perhaps Im approaching this the wrong way?:
1. Change IP address, MAC address, etc to fit to your spinneret. Youll see these in the INIT function of my code
2. Program it into propeller using prop plug on spinneret
3. The program will go ahead and initialize the common registers and then will prompt you to hit W for write, R for Read, Z for reset or E for Exit. This is meant to be a LIVE interface so I can quickly write and read certain registers using the terminal. Just hit E for exit for now and it will go through setting the mode for the socket, etc and setting it to listen.
4. Type in the IP address with the necessary port (I have port set as 5555 in my code) into your web browser and try to connect
5. The terminal should now be prompting you to make another selection of typing, W,R,Z or E. Type E and it will go through establishing the socket and reading data from the RX memory.
6. This is the part thats tripping me up. After reading the memory, I want it to write a string back to the web server and have it appear on the screen. Not sure if its something I have written incorrectly in the string or the sequence and timing of the SEND, DISCON and then CLOSE commands.
I appreciate anyone wholl take the time to test this out and see where I may be going wrong!
[FONT="]Thanks,[/FONT]
spin
16K
Comments
Just comment the LIVE method in check_socket.
Thanks for the response! That makes sense..i tried commenting the LIVE line so the server services the request when the socket is established but i still don't receive anything in the web browser once the data is put in the tx buffer and sent. Were you able to get the string i wrote in the DAT block to appear in the web browser? Is there something wrong with my HTML?
Thanks again
The HTML should look like
I commented all the waitcnt commands in senddata. No timeout but the browser was blank.
I also commented this section
1. at times i'm reading the interrupt register to be $05 while sending data and $15 after sending which makes sense. But sometimes i'll read the register to be $17 the entire time which is supposed to mean that it's connected, disconnected or has received a disconnect request and has received data or data is still available for reading after recv request, and that data has been sent ok...what can this mean?
2. my real tx memory address start is 46C9 and last address 4726 after sending data. I used strsize on my string and the string size is 92 and as you can see here the difference between the start and end addresses is 93 so i should be good. However before sending data i read TX_RR to be 40EF and after sending data to be 40E7. This doesn't seem possible since it would appear to be going backwards and isn't within the addresses where data is being sent in the TX memory.
most recent code is attached
any ideas why TX_RR doesn't end at the same address as TX_WR?! so close...
I think you are referring to memory buffers. If so, the calculation is in the W5100 datasheet.
I don't know what would be wrong with my content-type header line, seems like it's a pretty basic thing to send. I'm not too familiar with HTML so if you have any recommendations for a simpler string to send let me know.
It appears from the spec sheet that TX_RR isn't even really used in sending data even though it mentions that when the SEND command is written, data is written from TX_RR to TX_WR. There doesn't appear to be any calculation necessary for TX_RR and from how i see that it functions not sure what would work. The code to write data to the TX buffer and write the command to SEND seems pretty basic but i'm at a loss, don't know what i'm missing.
This is telling me that i am writing correctly to the TX memory buffer and indeed sending it to the web browser. However as i mentioned earlier, after i wrote over mike's code in the EEPROM, all the web page does is just linger until i close the socket and it stops trying to connect, never really times out.
if someone has any idea on what i may be doing wrong i'd appreciate it. I feel it's something to do with my HTML... i've spent a while working on my own SPI driver that's all in spin and i feel like i'm on the 5 yard line and just can't punch it in.
THanks,
P.S. does anyone know of another simple SPI driver that is around that doesn't depend on assembly or on the SPI and Indirect Driver already posted?
The garbled text indicates writing an unexpected block of EEPROM to the Tx buffer, probably a pointer issue.
The Content-Type: header tells the browser what kind of content to expect; image, text, JavaScript... In my experience, Content-Type errors show as unexpected formatting or the browser asking to save a file.
Here are a few notes:
1. After sending data you can execute the LIVE function which is a function that lets you read and write to registers and helps with troubleshooting. There is a waitcnt command after sending so once you punch in your IP address and port into a web browser, you can quickly enable your terminal and read additional information.
2. Reading information is currently commented out but if you want to see what is sent when typing into a web browser, you can uncomment it out.
any questions, please feel free to ask and comment!