I’ve been working on a driver for STM32F4 to work with W6100 over SPI using MikroC Pro for ARM.
Initially implementing a Telnet server just to get things started.
So far this has been pretty sucessful, can read chip ID etc. set MAC address , IPv4 parameters , establish a TCP connection and receive data from a telnet client.
However it appears that I’m misunderstanding what is required for TX.
As I understand I should:-
- Get the TX buffer size for the socket in use by reading Sn_TX_BSR (0x0200)
- Check the free size in the socket TX buffer by reading Sn_TX_FSR(0x0204)
- Get the buffer start address by reading Sn_TX_WR(0x020C)
- Write my TX data to the buffer at the buffer start address.
- Write the new buffer start (old buffer start + message size) to socket write pointer Sn_TX_WR(0x020C)
- Write ‘send’ command (0x20) to socket Command Register Sn_CR(0x0010)
- Poll Sn_CR(0x0010) until ==0
When I do this I get a lot of garbage transmitted, with my message text somewhere towards the end.
It looks like I’m misunderstanding the process, can anybody offer any advice?