Hi
The uTasker project is a demo project which contains pretty much everything required as base for most general projects. It is however still just an example and in some cases it may be required to start with a fresh sheet. In this case it is advisable to add a fresh project and start there rather than weeding out the bits from the demo which are not required. How to start a fresh project is explained in
http://www.utasker.com/docs/uTasker/uTaskerV1.3_user_guide.PDF (from page 2) and you may like to take this root.
What you want to do is make an
Ethernet<->RS232 converter. This is not included as part of the demo project. The main reason was due to the fact that it is not as simple as it first seems and there would be a risk of the uTasker project migrating to an
Ethernet<->RS232 project rather than remaining a general tool.
The following shows an example of a product which was realised using the uTasker:
http://www.xmodus.ch/sm_lan.htmlIn fact the difficulty is not in the basic operation, such as transferring Ethernet received frames to UART and the reverse - this is very easy. But, the complications start when flow control is considered. That is, what to do when the remote side's UART is blocked due to flow control (assuming UART - but other interfaces or internal processing can lead to the same effect)? This then causes the remote side to have to store the received data until its buffers fill. Then this progresses through the TCP/IP part (windowing) back to the local part, so the flow control finally works its way back to the local UART too, which can't clear input data since the remote TCP socket has closed its window.
All of the support to do this is however present in the package but it does require a bit more work than originally expected before it all works correctly under all circumstances. In fact the result can however still be very efficient, using very small amounts of memory (FLASH and SRAM). The 32k SRAM based SAM7X128 used in the example managed to achieve better file transfer throughput than another product on the market based on an ARM9 with 16Meg SDRAM...
So how to start?Well I would in fact first stay with the demo project - at least for the first steps - and do a quick tests as follows:
1) Establish a TELNET connection (since the Telnet socket type is the one to use) - ensure
USE_TELNET is enabled in the demo project.
2) In
application.c add the following line (ensure
SERIAL_INTERFACE is enabled):
...
while ((Length = fnRead( SerialPortID, ucInputMessage, MEDIUM_MESSAGE)) != 0) {
fnWrite(NETWORK_HANDLE, ucInputMessage, Length); // <--- send all UART input to TCP (TELNET connection)
...This will already achieve
UART -> Ethernet3) In
fnTELNETListener() in
debug.c add the following line
...
case TCP_EVENT_DATA:
fnWrite(SerialPortID, ucIp_Data, usPortLen); // <----- send all TCP/IP input to the UART
...This will then achieve
Ethernet -> UARTHowever, as mentioned earlier, there is quite a lot involved to make this into a complete project for a real product. But once the data starts flowing it does make it more fun to work on;-)
Good luck.
Regards
Mark