Comments (10)
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.
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.
I don't think there is...
from ada_drivers_library.
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, ðernetif_init,
ðernet_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.
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.
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.
Thanks for the link Adrian, it would be interesting to see if this client can run a micro-controller.
from ada_drivers_library.
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.
from ada_drivers_library.
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)
- FE310-specific performance counters HOT 1
- install_dependencies.py appears to be broken HOT 2
- Some examples do not build HOT 6
- Support LSM303AGR for newer micro:bit hardware revisions HOT 1
- Target not found for Micro:Bit with Debian Linux HOT 3
- Project Wizard doesn't generate startup files HOT 3
- Include directions in examples/README.md to have compatible versions of bb-runtimes and compiler
- Support for Adafruit Feather M0 board HOT 3
- mma8653 initialization fails on MicroBit HOT 21
- EXAMPLES: Installing run-time dependencies fails with both Python 2 and Python 3 on Linux HOT 2
- Make HAL packages preelaborable HOT 1
- I2C HAL ideas HOT 15
- Many warnings with GCC 12 HOT 2
- RISC-V requires "zicsr" ISA extension to build with FSF GNAT 12.1.1 HOT 11
- IO expander MCP23x08 reports GPIO mode always as Output HOT 1
- Support for STM32F411CEU6 board HOT 1
- Extension zicsr required in HiFive1_rev_B board
- Microbit.Time resets the board
- How to get the toolchain up and running? HOT 15
- Compiler crash with pragma Ada_2022 on body HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ada_drivers_library.