Giter Club home page Giter Club logo

Comments (10)

Fabien-Chouteau avatar Fabien-Chouteau commented on July 21, 2024

Tristan started to play with the Ethernet controller already. You can have a look here: https://github.com/AdaCore/Ada_Drivers_Library/blob/master/components/eth/stm32-eth.adb

from ada_drivers_library.

 avatar commented on July 21, 2024

Yes, thank you for that - I'd seen the program. I managed to find another
that had the abbreviations for the registers explained.

Unfortunately this does not include the two critical things to get the
ethernet card working:

  • setting the MAC address
  • Enabling DHCP

Once these are working, the rest should work well too - mostly, there's no
need to set the register details because they are negotiated by both sides.

Do you know if there is any Ada code anywhere that does this?

On 24 August 2016 at 23:12, Fabien Chouteau [email protected]
wrote:

Tristan started to play with the Ethernet controller already. You can have
a look here: https://github.com/AdaCore/Ada_Drivers_Library/blob/
master/components/eth/stm32-eth.adb


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#41 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AESqR_Tdc0D4uLK7tVysfDSIoCE0rmGCks5qjLOhgaJpZM4Jql-S
.

from ada_drivers_library.

Fabien-Chouteau avatar Fabien-Chouteau commented on July 21, 2024

I don't think there is...

from ada_drivers_library.

 avatar commented on July 21, 2024

OK.

In C, the bit to set for DHCP is:

#define LWIP_DHCP

Defined in the file:
https://github.com/esp8266/Arduino/blob/master/tools/sdk/lwip/include/lwipopts.h

It is described here: http://lwip.wikia.com/wiki/DHCP

The ST32 documentation (
http://www.st.com/content/ccc/resource/technical/document/application_note/66/dd/f9/3f/5f/75/49/c8/CD00255062.pdf/files/CD00255062.pdf/jcr:content/translations/en.CD00255062.pdf
)

says that you set the MAC address by:

"

When the Server/Client example is used, and in the case of a client,
the firmware sets a different MAC address by replacing the sixth byte
by the CLIENTMAC6 defined in the netconf.c file.

"

netconf.c is here:
https://github.com/mikeferguson/stm32/blob/master/projects/smaldog/netconf.c

My question is how to translate these to Ada.

Not everything, just these two steps.

It's essentially this code ( from here:
https://github.com/mikeferguson/stm32/blob/master/projects/smaldog/netconf.c
)

void LwIP_Init(void)
{
struct ip_addr ipaddr;
struct ip_addr netmask;
struct ip_addr gw;
uint8_t macaddress[6]={0,0,0,0,0,1};
/* Initializes the dynamic memory heap defined by MEM_SIZE./
mem_init();
/
Initializes the memory pools defined by MEMP_NUM_x./
memp_init();
IP4_ADDR(&ipaddr, 192, 168, 0, 42);
IP4_ADDR(&netmask, 255, 255, 255, 0);
IP4_ADDR(&gw, 192, 168, 0, 1);
//Set_MAC_Address(macaddress);
/
- netif_add(struct netif netif, struct ip_addr *ipaddr,
struct ip_addr *netmask, struct ip_addr *gw,
void *state, err_t (
init)(struct netif netif),
err_t (
input)(struct pbuf p, struct netif *netif))
Adds your network interface to the netif_list. Allocate a struct
netif and pass a pointer to this structure as the first argument.
Give pointers to cleared ip_addr structures when using DHCP,
or fill them with sane numbers otherwise. The state pointer may be NULL.
The init function pointer must point to a initialization function for
your ethernet netif interface. The following code illustrates it's use.
/
netif_add(&netif, &ipaddr, &netmask, &gw, NULL, &ethernetif_init,
&ethernet_input);
/* Registers the default network interface./
netif_set_default(&netif);
/
When the netif is fully configured this function must be called.*/
netif_set_up(&netif);
}

On 26 August 2016 at 11:37, Fabien Chouteau [email protected] wrote:

I don't think there is...


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

from ada_drivers_library.

Fabien-Chouteau avatar Fabien-Chouteau commented on July 21, 2024

It looks like there's a lot a code involved, netconf.c is just the tip of the iceberg. You will have to implement this in Ada or maybe write a binding to the C code...

from ada_drivers_library.

Kensan avatar Kensan commented on July 21, 2024

Related to the DHCP question: we implemented a DHCP client in Ada see [1]. Maybe the code can be helpful and give some ideas.

[1] - https://www.codelabs.ch/adhcp/

from ada_drivers_library.

Fabien-Chouteau avatar Fabien-Chouteau commented on July 21, 2024

Thanks for the link Adrian, it would be interesting to see if this client can run a micro-controller.

from ada_drivers_library.

 avatar commented on July 21, 2024

Thank you for that example.

Unfortunately, the problem is that it's not embedded, and it does DHCP
explicitly.

The chip on the STM32 board implements DHCP, as a client, itself. All
that's necessary is to set the MAC address, and set the bit telling it to
use DHCP instead of a fixed IP address, and it does all the rest.

On 31 August 2016 at 17:41, Adrian-Ken Rueegsegger <[email protected]

wrote:

Related to the DHCP question: we implemented a DHCP client in Ada see [1].
Maybe the code can be helpful and give some ideas.

[1] - https://www.codelabs.ch/adhcp/


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#41 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AESqRxwtKeuVL2WZoaOxiVehQh-Wyjtlks5qlaCVgaJpZM4Jql-S
.

from ada_drivers_library.

 avatar commented on July 21, 2024

from ada_drivers_library.

Fabien-Chouteau avatar Fabien-Chouteau commented on July 21, 2024

I was wondering what happened to the .gpr files in the 'examples' directory, like this one:

Because of the re-organization of projects and the dependency on the embbeded-runtimes repository, this is not possible anymore.

I found it very useful to be able to build all the demos in one go, as a sanity check.

I miss that too, but we think that the gain is greater than the loss.

Also, just as a thought, how difficult would it be to build the demos into one integrated demo, with each a sub-task? I think such a demo-of-demos would be most instructive to newcomers.

I'm in favor of this, if it's done right. I personally think that we need only one example per board, an example that would show as many features as possible in steps:

  • Step 1: LCD
  • Step 2: Touch screen
  • Step 3: Audio
  • Step 4: USB
  • Step 5: Ethernet
  • Step 6: SDcard
  • etc.

from ada_drivers_library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.