renatoaloi / EtherEncLib

Ethernet ENC28J60 Library for Arduino
GNU General Public License v3.0
26 stars 14 forks source link

Enc28coremerge amendments.. #2

Closed ska-la closed 9 years ago

ska-la commented 9 years ago

Hello, Renato. If you have interest still i offer some amendments for the library. First of all, look at the patch because all the work based on it. Final result is a web server, which provides a html pages (not only) are resided on a SD/TF card. To quick start, new example was added. Please, test it. But before apply SD_soft_atmega328.patch . The example is not for end users, but for develop purpose only. The work is too raw, and i'm ready to make a more carefully job. I'll not annoy you, test it and make decision what next.. In positive case we can discuss all details.

Regards, ska.

renatoaloi commented 9 years ago

I am testing my own enc28coremerge branch and it only work once per reset. Do you have Arduino connected to Router? Or it is connected directly to computer? I will test your version right now. That SPI Bug is minning all our work!

renatoaloi commented 9 years ago

SKA, your implementation is woking much better than my original! That work you did at SPI is fine art! Everything running smoothly here!

renatoaloi commented 9 years ago

Ok, I need to work on these 2 buffers:

uchar m_tcpData[DATA_SIZE]; uchar m_sendData[DATA_SIZE];

where:

//--- made by SKA ---#define DATA_SIZE 95

define DATA_SIZE 145

So.. we have 2 static buffers occuping 300 bytes from RAM forever! I must put and end to them! :)

I just need to use MACWriteTXBuffer() to use the TX buffer from enc28j60's 8k hardware buffer... The trick here is put the pointer where it was, let me see...

renatoaloi commented 9 years ago

Well... trying to do this: // by Renato Aloi May 2015 // Trying to implement SocketTX avoiding RAM buffers // New rule of 3 buffers // 1. Buffer for incomming TCP Headers (58 bytes) -- TcpStack->m_tcpData[] // 2. Buffer for outcomming TCP Headers (58 bytes) -- TcpStack->m_sendData[] // 3. Buffer for Http parameters (50 bytes) -- EtherEncLib->m_httpData[] // Total RAM from Buffers: 166 bytes

renatoaloi commented 9 years ago

Its working! Bufferless ENC28J60 library! It sends 1024-bytes per time.

Final command for TX DMA Copy: DMACopy(TX, TXSTART_INIT + ETH_HEADER_LEN_V + IP_HEADER_LEN_V + TCP_HEADER_LEN_PLAIN_V + 1, m_sizePayload); waitForDMACopy();

Finishing checksum calculation, it got wrong because I am copying data later. Working on that now.