aretallack 0 Posted July 28, 2014 Share Posted July 28, 2014 I hate having to ask for help - but I'm stumped so here I am cap in hand...! I've spent the best part of 4 days googling, testing, coding, etc. to try to get the example code provided in this post 29 working - posting data to Sparkfun's new simple IoT data collection site: data.sparkfun.com. I've now gone back to the original code as I thought I may have modified more than I should have! Originally the code worked, and posted to the ste correcty. Then it just stopped connecting... to anything. I then setup a quick Python socket server listening on port 50009 - and tested it using telnet. Still no success. From the original example code I have: - modified the source & dest IP, gateway and dest port - added breakpoints to look at getSn_SR(s) In the below code, the getSn_SR(s) returns: - 0x13 (SOCK_INIT) after the openSocket, which I'd expect - 0x00 after the connect call, which I didn't expect void startClient(u_char s, u_char *destinationIP, u_char port) { volatile u_char connResult; // make sure socket is closed waitUntilSocketClosed(s); // open socket on arbitrary port openSocketOnPort(s, 0); connResult = getSn_SR(s); // ****RETURNS 0x13**** // connect connect(s, destinationIP, port); connResult = getSn_SR(s); // ****RETURNS 0x00**** // verify connection was established // TODO add timer/counter to prevent endless loop when connection cannot be established while (!isConnected(s)) ; } Can anyone give me any guidance to troubleshoot the connect function? WOuld be most grateful. Thanks Andrew Quote Link to post Share on other sites
RobG 1,892 Posted July 28, 2014 Author Share Posted July 28, 2014 @@aretallack, you need to add new line after each line and two after last one. addStringToBuffer((const u_char*) "GET /contact/ HTTP/1.1"); addStringToBuffer(sNEW_LINE); addStringToBuffer((const u_char*) "Host: www.crash-bang.com"); addStringToBuffer(sNEW_LINE); addStringToBuffer((const u_char*) "Connection: close"); addStringToBuffer(sNEW_LINE); addStringToBuffer(sNEW_LINE); flushBuffer(); aretallack 1 Quote Link to post Share on other sites
aretallack 0 Posted July 28, 2014 Share Posted July 28, 2014 Thanks @RogG - that'll help! Sorry, I've gone and amended the post from under you - bad etiquette I guess! The issue I'm facing now is establishing a connection. Incidentally, I'm able to runAsServer and all works perfectly, soI'm comfortable the board is working ok. Quote Link to post Share on other sites
RobG 1,892 Posted July 28, 2014 Author Share Posted July 28, 2014 FYI, GET /contact/ HTTP/1.1 returns redirect to https://.... Client code doesn't handle redirects or https. aretallack 1 Quote Link to post Share on other sites
CFred 0 Posted August 22, 2014 Share Posted August 22, 2014 Hello, Im new to the forum and I must say this is one of the more fun projects to play with. Thank you for all the work on the code!! I am having an issue with the DHCP lib, i keep getting the following error: dhcp read option: insufficient bytes (1) to read a DHCP option field I am a noob and trying to understand how this all works. Any help or ideas or things to look at is helpful! Thanks Quote Link to post Share on other sites
funky 0 Posted September 13, 2014 Share Posted September 13, 2014 I am beginner totally ! Is there any tutorial about Ethernet for MSP430 with your BP RobG ? Quote Link to post Share on other sites
cheesuslovesme 0 Posted October 21, 2014 Share Posted October 21, 2014 Buy: The 43oh Store or Rob's Tindie Store. The newest version of the Ethernet BoosterPack is based on the newest chip from WIZnet, W5500. P1.5 - SCLK P1.6 - MISO P1.7 - MOSI P2.3 - /CS P2.4 - /INT P2.5 - /RST photo-2.jpg Configuration jumpers are on the bottom, PMODE1-PMODE3, LINK LED, and ACT LED. LED jumpers control which LEDs are used, on board or socket. ebp3-j2.jpgebp3-j1.jpg Available on Tindie. Do you know what headers could be added to the PM0-PM2 so that they could be temporarily jumpered for debugging? Do you have any other suggestions? Quote Link to post Share on other sites
RobG 1,892 Posted October 21, 2014 Author Share Posted October 21, 2014 @@cheesuslovesme, you can connect them to P2.0, P2.1, & P2.2 Quote Link to post Share on other sites
Fmilburn 446 Posted March 15, 2016 Share Posted March 15, 2016 Hello @@RobG This thread is pretty old now and I notice that your BoosterPack has been retired, but I have recently started doing some experiments with the W5500 and G2553. Question: Is the latest code that was developed for your BoosterPack in the link that @@spirilis provided above? Are there open issues you are aware of? I plan on sharing anything I come up with. EDIT: For example I noticed that you used the MSP430F5172 in your RGB controller and wondered if memory was a problem. Quote Link to post Share on other sites
spirilis 1,265 Posted March 15, 2016 Share Posted March 15, 2016 Memory (SRAM) can become a problem in a real hurry with those. Buffer sizes with the Wiznet is something like 2KB yet you only have 512b to work with... Fmilburn 1 Quote Link to post Share on other sites
spirilis 1,265 Posted March 15, 2016 Share Posted March 15, 2016 Hello @@RobG This thread is pretty old now and I notice that your BoosterPack has been retired, but I have recently started doing some experiments with the W5500 and G2553. Question: Is the latest code that was developed for your BoosterPack in the link that @@spirilis provided above? Are there open issues you are aware of? I plan on sharing anything I come up with. EDIT: For example I noticed that you used the MSP430F5172 in your RGB controller and wondered if memory was a problem. Fwiw, I bet the MSP430G2955 would be perfect for Wiznet work. 56K flash, 4KB SRAM.... much more comfortable. Just for kicks, this is the kind of BS I had to do to get DHCP working on a G2553, and it still leaves little room for error (probability of stack overflowing into the heap): int dhcp_loop_configure(uint8_t *dnsaddr, struct DHCPrenew *lease) { uint8_t scratch[34]; ... int dhcp_send_packet(uint8_t sockfd, uint8_t *scratch, uint8_t dhcp_msgtype) { uint8_t *ourmac = scratch+SOFF_SIADDR_ACK; // Overloading SIADDR_ACK + optcode + optlen to hold the MAC address uint8_t *yiaddr = scratch+SOFF_YIADDR; uint8_t *siaddr = scratch+SOFF_SIADDR; ... // Read initial DHCP information int dhcp_read_header(uint8_t sockfd, uint8_t *scratch, uint8_t *ciaddr, uint8_t *yiaddr, uint8_t *siaddr, uint8_t *giaddr, uint8_t *chaddr) { uint8_t *xid = scratch+SOFF_XID; Basically the primary function dhcp_loop_configure includes a stack-allocated scratch buffer 34 bytes long, and passes it to subjugate functions where it might reuse some of the bytes or abuse them in kind. There was some tetris dancing involved where I had to assume (and analyze to validate it's safe) that certain scratch array positions would be reusable across different function calls based on the overall flow and sequence of the protocol. Fmilburn 1 Quote Link to post Share on other sites
Fmilburn 446 Posted March 15, 2016 Share Posted March 15, 2016 @@spirilis Thanks for the explanation. Clever. I haven't given up on the G2553 quite yet, but will look at the MSP430G2953 - probably make my life easier. Quote Link to post Share on other sites
spirilis 1,265 Posted March 15, 2016 Share Posted March 15, 2016 @@spirilis Thanks for the explanation. Clever. I haven't given up on the G2553 quite yet, but will look at the MSP430G2953 - probably make my life easier. G2955 specifically... 5th generation of value line (note the 5 at the end). The 4th and 5th gen Value Line chips almost "quietly" appeared a couple years ago in TSSOP & QFN-only packages, but they are relatively easy to solder if you're comfortable with SMD work (TI's "DA" package, used by the MSP430F5172 too, is a 38-pin TSSOP package in 0.65mm aka 25-mil pitch) Peripherals on the G2xx4/G2xx5 work very similarly to the G2553, they use USCI for comms and BCS for clocking but the newer ones do have a Timer_B in addition to their Timer_A peripherals. Fmilburn 1 Quote Link to post Share on other sites
Fmilburn 446 Posted March 16, 2016 Share Posted March 16, 2016 I had some time to work on this again this evening. Using a F5529 cleared things up and I was able to get DHCP to work. G2955 specifically... 5th generation of value line (note the 5 at the end). The 4th and 5th gen Value Line chips almost "quietly" appeared a couple years ago in TSSOP & QFN-only packages, but they are relatively easy to solder if you're comfortable with SMD work (TI's "DA" package, used by the MSP430F5172 too, is a 38-pin TSSOP package in 0.65mm aka 25-mil pitch) I haven't soldered SMD by hand but now that I am getting comfortable designing PCBs I am ready to try. Peripherals on the G2xx4/G2xx5 work very similarly to the G2553, they use USCI for comms and BCS for clocking but the newer ones do have a Timer_B in addition to their Timer_A peripherals. I definitely would like to give these a try. Quote Link to post Share on other sites
Fmilburn 446 Posted March 25, 2016 Share Posted March 25, 2016 @@spirilis Thanks for your suggestion to look at the MSP430G2955, it has worked out well. I ordered a few G2955s TSSOP and successfully did my first SMD hand soldering. I have decided to use Energia, and lightly modified / cleaned up the code at the WIZnet site so that it installs and runs as an Energia library more easily. Tested on G2955 and F5529 with Energia v17. For those interested the code is here. chicken and spirilis 2 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.