fetisov / lrndis Goto Github PK
View Code? Open in Web Editor NEWstm32 ethernet over usb (rndis + lwip)
License: MIT License
stm32 ethernet over usb (rndis + lwip)
License: MIT License
After very carefully migrating usbd_rndis_core.c
to use the new API's (eg. mapping DCD_EP_PrepareRx
to USBD_LL_PrepareReceive
), I can report that the resulting code does not work.
For reference, see my changes here:
Hello1024@15b3818
The device enumerates fine, and control messages seem to be sent fine (the mac address is discovered by the host for example).
Actual data messages seem to fail though. A USB trace shows that after every SOF, a BULK IN packet is created on RNDIS_NOTIFICATION_IN_EP
, but never followed up with an actual data packet, which is a usb protocol error in both linux and windows. Both retry thousands of times per second, but never get anywhere.
I haven't managed to successfully debug it yet. The device isn't locking up or anything, because it still responds to other message types.
case REMOTE_NDIS_QUERY_MSG:
rndis_query(pdev);
break;
case REMOTE_NDIS_SET_MSG:
rndis_handle_set_msg(pdev);
break;
case REMOTE_NDIS_RESET_MSG:
{
rndis_reset_cmplt_t * m;
m = ((rndis_reset_cmplt_t *)encapsulated_buffer);
rndis_state = rndis_uninitialized;
m->MessageType = REMOTE_NDIS_RESET_CMPLT;
m->MessageLength = sizeof(rndis_reset_cmplt_t);
m->Status = RNDIS_STATUS_SUCCESS;
m->AddressingReset = 1; /* Make it look like we did something */
// m->AddressingReset = 0; //Windows halts if set to 1 for some reason
DCD_EP_Tx(pdev, RNDIS_NOTIFICATION_IN_EP, (uint8_t *)"\x01\x00\x00\x00\x00\x00\x00\x00", 8);
}
break;
case REMOTE_NDIS_KEEPALIVE_MSG:
I see that you IDE project is custom-made. Have you considered embedding your work to Cubemx-generated project so that it can be easily integrated to projects that use FreeRTOS, for example. Cubemx does have pre-configured FreeRTOS.
Hi
It works great on Win7 but I now want to use it on W10 but it always gets recognised as a serial port.
I have searched for a solution with no success.
Do you have any suggestions?
Thanks
Andy.
Hi,
how do you verify if the message is completely received, if the length is "Length%64=0":
lrndis/lrndis/rndis-stm32/usbd_rndis_core.c
Line 601 in 7a998f1
I wasn't able to deliver such messages on to my bus and had to modify your code slightly, by getting the message length in the first usb frame from the header and receiving following frames until I had a complete message by comparing received bytes with the message length in the header:
if (rndis_received + ep->xfer_count <= RNDIS_RX_BUFFER_SIZE)
{
// copy fragment into frame buffer
memcpy(&rndis_rx_buffer[rndis_received], usb_rx_buffer, ep->xfer_count);
// if first fragment, extract frame length
if( rndis_received == 0 )
{
rndis_header = (rndis_data_packet_t *)rndis_rx_buffer;
rndis_MessageLength = rndis_header->MessageLength;
}
rndis_received += ep->xfer_count;
if (ep->xfer_count != RNDIS_DATA_OUT_SZ || rndis_received == rndis_MessageLength)
{
handle_packet(rndis_rx_buffer, rndis_received);
rndis_received = 0;
}
}
Dear Sergey,
I am impressed by your great work and want to try it.
Unfortunately, I work on Eclipse and GCC and my tries to port the project failed.
Is it possible to prepare your project as Makefile for GCC?
Thanks in advance and best regards
Christo
Hello
I tested. I have a lot problems because my hardware is probably different and I'm again a newbie with these technologies.
For the newbie, can you add a tutorial or links for:
Now for my problem, when I connect my card, I can see correctly the network card with the config dhcp on my pc but I cannot see the website.
I try to ping the card. During the 2 first seconds, it works and after, the card is unresponsive.
Any idea ?
Thanks
Karima
I saw the usage of the makefsdata.c but can not understand, but your fsdata.c file is running in my code which directly generated the code from the stm32cubemx. using perl makefsdata.exe it create the array but server not running.
can you give me suggest how to use makefsdata.c to generate the fsdata.c??????
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.