Giter Club home page Giter Club logo

Comments (6)

loathingKernel avatar loathingKernel commented on July 4, 2024

Arduino provided avr toolchain is lagging behind quite a few versions. To compile, i am using the latest avr toolchain as it is provided by my package manager.

I haven't tried to compile on windows but on of these might be useful:
http://winavr.sourceforge.net/
http://www.atmel.com/tools/atmelstudio.aspx

You will need to edit the Makefile to change the paths but that should be quite straight forward.

Good luck with your project and I am eager to see the results.

from ariadne-bootloader.

johnvanzijl avatar johnvanzijl commented on July 4, 2024

Hi Stelios,

Thanks for the help, I can compile the bootloader now. I did have some
trouble downloading it into the Mega2560 Board. Finanly I discovered
that the Bootloader update function simply doesn't work on my win7 64x
with the mkII ISP. Using a separate AVRDUDE solved that problem. However
I do need some other help.

it seems that the function to set the IP and MAC has a bit of a problem.

Here the source of w5100.c that I changed a bit to debug. I simply print
the settings before and after the eprom reading. I seems that I cannot
read the registerBuffer at all!! I can boot, I can send a sketch
(serial) everything else in order. Any Ideas???

uint8_t registerBuffer[REGISTER_BLOCK_SIZE] = {
0x80, // MR Mode - reset device

 // EEPROM block starts here
 GW_ADDR,      // GWR Gateway IP Address Register
 SUB_MASK,  // SUBR Subnet Mask Register
 MAC_ADDR,     // SHAR Source Hardware Address Register
 IP_ADDR,      // SIPR Source IP Address Register
 // EEPROM block ends here

 0, 0,         // Reserved locations
 0,            // IR Interrupt Register
 0,            // IMR Interrupt Mask Register
 0x07, 0xd0,   // RTR Retry Time-value Register
 0x80,         // RCR Retry Count Register
 0x55,         // RMSR Rx Memory Size Register, 2K per socket
 0x55          // TMSR Tx Memory Size Register, 2K per socket

};

void netInit(void)
{
uint8_t i;

     DBG_NET(
     tracePGMlnNet(mDebugNet_ADDR);
     for(i = 15; i < 19; i++) {
         tracenet(registerBuffer[i]);
         if(i != 18) putch(0x2E);
     }
     tracePGMlnNet(mDebugNet_SUBN);
     for(i = 5; i < 9; i++) {
         tracenet(registerBuffer[i]);
         if(i != 8) putch(0x2E);
     }
     tracePGMlnNet(mDebugNet_GW);
     for(i = 1; i < 5; i++) {
         tracenet(registerBuffer[i]);
         if(i != 4) putch(0x2E);
     }
     tracePGMlnNet(mDebugNet_MAC);
     for(i = 9; i < 15; i++) {
         tracenet(registerBuffer[i]);
         if(i != 14) putch(0x2E);
     }
 )

 /* Pull in altered network settings, if available,
  * from AVR EEPROM (if signature bytes are set) */
 if((eeprom_read_byte(EEPROM_SIG_1) == EEPROM_SIG_1_VALUE)
     && (eeprom_read_byte(EEPROM_SIG_2) == EEPROM_SIG_2_VALUE)) {

     for(i = 0; i < EEPROM_SETTINGS_SIZE; i++)
         registerBuffer[i + 1] = eeprom_read_byte(EEPROM_DATA + i);

     DBG_NET(tracePGMlnNet(mDebugNet_EEPROM);)

 } DBG_NET(
     else tracePGMlnNet(mDebugNet_BUILTIN);
 )


 DBG_NET(
     tracePGMlnNet(mDebugNet_ADDR);
     for(i = 15; i < 19; i++) {
         tracenet(registerBuffer[i]);
         if(i != 18) putch(0x2E);
     }
     tracePGMlnNet(mDebugNet_SUBN);
     for(i = 5; i < 9; i++) {
         tracenet(registerBuffer[i]);
         if(i != 8) putch(0x2E);
     }
     tracePGMlnNet(mDebugNet_GW);
     for(i = 1; i < 5; i++) {
         tracenet(registerBuffer[i]);
         if(i != 4) putch(0x2E);
     }
     tracePGMlnNet(mDebugNet_MAC);
     for(i = 9; i < 15; i++) {
         tracenet(registerBuffer[i]);
         if(i != 14) putch(0x2E);
     }
 )

Here the output:

Main: Ariadne for Arduino Mega2560, Version 0.5
Main: Init spi comm
Spi: SPI init done
Main: Init network layer
Net: Address: 0xFF.0xFF.0xFF.0xFF
Net: Subnet: 0xFF.0xFF.0xFF.0xFF
Net: Gateway: 0xFF.0xFF.0xFF.0xFF
Net: MAC: 0xFF.0xFF.0xFF.0xFF.0xFF.0xFF
Net: Built-in settings
Net: Address: 0xFF.0xFF.0xFF.0xFF
Net: Subnet: 0xFF.0xFF.0xFF.0xFF
Net: Gateway: 0xFF.0xFF.0xFF.0xFF
Net: MAC: 0xFF.0xFF.0xFF.0xFF.0xFF.0xFF
Spi: spiWriteReg: 0x0000, 0x00FF
Spi: spiWriteReg: 0x0001, 0x00FF
Spi: spiWriteReg: 0x0002, 0x00FF
Spi: spiWriteReg: 0x0003, 0x00FF
Spi: spiWriteReg: 0x0004, 0x00FF
Spi: spiWriteReg: 0x0005, 0x00FF

cheers, John

Arduino provided avr toolchain is lagging behind quite a few versions.
To compile, i am using the latest avr toolchain as it is provided by
my package manager.

I haven't tried to compile on windows but on of these might be useful:
http://winavr.sourceforge.net/
http://www.atmel.com/tools/atmelstudio.aspx

You will need to edit the Makefile to change the paths but that should
be quite straight forward.

Good luck with your project and I am eager to see the results.


Reply to this email directly or view it on GitHub
#10 (comment).

from ariadne-bootloader.

johnvanzijl avatar johnvanzijl commented on July 4, 2024

Hi Stelios,

Looking for an error in my compiling settings I found something strange. I looked into the online ariadne_atmega2560.lst then I removed the asm lines and compared them with the w5100.c source code. It seems that there are differences. Looks to me that not all source codes are not up to date.

Would it be possible to update all sources?

cheers,

John

LST:

void netInit(void)
{
uint8_t i;

    /* Pull in altered network settings, if available,
     * from AVR EEPROM (if signature bytes are set) */

    if((eeprom_read_byte(EEPROM_SIG_1) == EEPROM_SIG_1_VALUE)
            && (eeprom_read_byte(EEPROM_SIG_2) == EEPROM_SIG_2_VALUE)) {
             for(i = 0; i < EEPROM_SETTINGS_SIZE; i++)
                    registerBuffer[i + 1] = eeprom_read_byte(EEPROM_DATA + i);

    /* Pull in altered network settings, if available,
     * from AVR EEPROM (if signature bytes are set) */
    if((eeprom_read_byte(EEPROM_SIG_1) == EEPROM_SIG_1_VALUE)
            && (eeprom_read_byte(EEPROM_SIG_2) == EEPROM_SIG_2_VALUE)) {

            for(i = 0; i < EEPROM_SETTINGS_SIZE; i++)
            }
    )

    /** Configure Wiznet chip. Network settings */
    for(i = 0; i < REGISTER_BLOCK_SIZE; i++)
            spiWriteReg(i, registerBuffer[i]);
                    if(i != 14) putch(0x2E);
            }
    )

    /** Configure Wiznet chip. Network settings */
    for(i = 0; i < REGISTER_BLOCK_SIZE; i++)
            spiWriteReg(i, registerBuffer[i]);

    DBG_NET(tracePGMlnNet(mDebugNet_DONE);)

}

Source:

void netInit(void)
{
uint8_t i;

/* Pull in altered network settings, if available,
 * from AVR EEPROM (if signature bytes are set) */
if((eeprom_read_byte(EEPROM_SIG_1) == EEPROM_SIG_1_VALUE)
    && (eeprom_read_byte(EEPROM_SIG_2) == EEPROM_SIG_2_VALUE)) {

    for(i = 0; i < EEPROM_SETTINGS_SIZE; i++)
        registerBuffer[i + 1] = eeprom_read_byte(EEPROM_DATA + i);

    DBG_NET(tracePGMlnNet(mDebugNet_EEPROM);)

} DBG_NET(
    else tracePGMlnNet(mDebugNet_BUILTIN);
)


DBG_NET(
    tracePGMlnNet(mDebugNet_ADDR);
    for(i = 15; i < 19; i++) {
        tracenet(registerBuffer[i]);
        if(i != 18) putch(0x2E);
    }
    tracePGMlnNet(mDebugNet_SUBN);
    for(i = 5; i < 9; i++) {
        tracenet(registerBuffer[i]);
        if(i != 8) putch(0x2E);
    }
    tracePGMlnNet(mDebugNet_GW);
    for(i = 1; i < 5; i++) {
        tracenet(registerBuffer[i]);
        if(i != 4) putch(0x2E);
    }
    tracePGMlnNet(mDebugNet_MAC);
    for(i = 9; i < 15; i++) {
        tracenet(registerBuffer[i]);
        if(i != 14) putch(0x2E);
    }
)

/** Configure Wiznet chip. Network settings */
for(i = 0; i < REGISTER_BLOCK_SIZE; i++)
    spiWriteReg(i, registerBuffer[i]);

DBG_NET(tracePGMlnNet(mDebugNet_DONE);)

}

from ariadne-bootloader.

loathingKernel avatar loathingKernel commented on July 4, 2024

According to my local git repo, everything is up to date and both mega and origin/mega are in sync.

Nevertheless, your problem still seems strange to me, so I will look into it in the next few days. It might take some time for me to reply, though, due to holidays.

from ariadne-bootloader.

johnvanzijl avatar johnvanzijl commented on July 4, 2024

Hi Stelios,

I found the problem, I replaced the AVR8 Gnu toolchain in arduino with the one from winavr 2010 (4.3.2) it seems that there are some bugs in there regarding mega2560 and upper memory.

After I removed all other source lines out of the bootloader I discovered the problem. Simply reading the registerBuffer gave almost random values, looks like the adressing wasn't right.

I installed ATMEL STUDIO 6 and copied the gnu toolchain (4.4.7) over the one in arduino and I can compile a bootloader now that I can access via TFTP and Serial.

Compiling a sketch with 4.4.7 gives some errors in WString.cpp but I can fix that.

Next I will change the software in tftp and w5100 to support a w5500.

Thanks for the help,

John

from ariadne-bootloader.

loathingKernel avatar loathingKernel commented on July 4, 2024

I am reopening this one since I want some more information on your issue. There have been known problems with upper program memory. Even in my current version of avr-gcc (4.8.2) i needed some workarounds for *_PF functions to be able to access progmem strings in the bootloader section of the atmega2560, which is at the end of the program memory.

The thing I find weird is that the issue is with registerBuffer, in which case the initial values are not being read by using the pgmspace.h functions but they are hardcoded in the initialization of the array. Considering that, I believe it has to do with erroneous compilation due to gcc version being old. I still have no idea what might be causing it.

from ariadne-bootloader.

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.