[En-Nut-Discussion] Nutos 5.1 on Ethernut 1.3g with multiple threads: network freezes
jwoithe at atrad.com.au
Tue Jun 30 03:54:42 CEST 2015
On Mon, Jun 29, 2015 at 05:48:36PM +0200, Harald Kipp wrote:
> IMHO it is a bad idea to contaminate Nut/OS drivers with board-specific
> code. Therefore board-specific initialization code had been added to
> Nut/OS some time ago. For Ethernut 1.3 this code includes NIC EEPROM
> emulation and is located in nut/arch/avr/board/ethernut1.c.
> This code will be automatically included and executed, if your board
> config file (nut/conf/ethernut1h.conf) contains
> NUT_INIT_BOARD = ""
> Unfortunately this item is missing in the configuration files of earlier
> hardware revisions.
> You can use the Configurator to enable this item at
> Hardware Platform -> Board Initialization
> Let us know, if it works. If it does, we should patch the other board
> configuration files instead of blowing up the NIC driver with board details.
I have managed to find time to test this. Using the minimal test program I
posted earlier I first confirmed that without the nicrtl.c patch the NIC was
still unresponsive. I then added
NUT_INIT_BOARD = ""
to the ethernut13g.conf file, reconfigured NutOS, and recompiled nutos and
the test firmware. This time the NIC was responsive and operated correctly.
Both tests were done on an ethernut 1.3g board as well as our own board
(which as previously explained is almost indistinguishable from an ethernut
1.3g), giving consistent results. I verified that the FakeNicEeprom() code
in ethernut1.c was included and called when NUT_INIT_BOARD was present in
the board configuration file, but not when NUT_INIT_BOARD was absent.
This at least explains my earlier observation and puzzlement that
ethernut1.c's EEPROM emulation code was not being called.
Based on all this, the correct fix for this problem is to include
NUT_INIT_BOARD in the ethernut13g.conf file, since this apparently ensures
that the EEPROM emulation code in ethernut1.c is used. A trivial patch to
do this is included at the end of this email.
Patching ethernut13g.conf (rather than defining a new configuration file for
our board) is the correct approach because ethernut 1.3g boards are affected
by this problem.
The RTL8019AS NIC on Ethernut 1.3g boards does not appear to initialise
reliably without software EEPROM emulation when the board circuitry is
configured to expect EEPROM emulation. Software EEPROM emulation code is
only included if NUT_INIT_BOARD is present in the board configuration.
While the ethernut 1.3h board configuration file includes this, the 1.3g
file does not. Since 1.3g boards are equipped with EEPROM emulation
hardware, the 1.3g configuration file must also include NUT_INIT_BOARD.
While many NutOS applications would work fine without this, others exhibited
various network-related problems.
Signed-off-by: Jonathan Woithe <jwoithe at atrad.com.au>
--- a/ethernut-5.1.0/nut/conf/ethernut13g.conf 2012-12-28 20:57:19.000000000 +1030
+++ b/ethernut-5.1.0/nut/conf/ethernut13g.conf 2015-06-30 10:41:36.329309412 +0930
@@ -49,6 +49,7 @@
+NUT_INIT_BOARD = ""
AVR_GCC = ""
MCU_ATMEGA128 = ""
NUTMEM_SIZE = "4096"
More information about the En-Nut-Discussion