• AVR Freaks

Initialization issues

Author
Corjan
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/10/28 05:24:43
  • Location: 0
  • Status: offline
2019/11/07 07:46:03 (permalink)
0

Initialization issues

Hi,
 
I'm working at a webserver project, builded on the basis of the Harmony Tutorial on Youtube from Microchip. But sometimes this error occured. It seems randomly (in my eyes). Because, yesterday everything was fine, closed project, shutted down computer. And then this morning: booted the computer, started MPLAB, compiled project and it came up with this error. As a result, the PIC is not accessible over network, the LED_ACT is also not blinking or active. LED_LINK is blinking. 
 
../src/system_config/YAHOO_SSL/system_init.c:507:9: warning: initialization makes pointer from integer without a cast [enabled by default]
         TCPIP_NETWORK_DEFAULT_INTERFACE_FLAGS_IDX0, // startFlags
         ^
../src/system_config/YAHOO_SSL/system_init.c:507:9: warning: (near initialization for 'TCPIP_HOSTS_CONFIGURATION[0].password') [enabled by default]
../src/system_config/YAHOO_SSL/system_init.c:508:8: warning: initialization from incompatible pointer type [enabled by default]
        &TCPIP_NETWORK_DEFAULT_MAC_DRIVER_IDX0, // pMacObject
        ^
../src/system_config/YAHOO_SSL/system_init.c:508:8: warning: (near initialization for 'TCPIP_HOSTS_CONFIGURATION[0].powerMode') [enabled by default]

 
It happened more often, but luckly I made some backups. (Backups from a working project at time of back up.) Sometimes the latest backup came also with above error, so I had to use two or three backups earlier. Since I have no idea what this error is meaning of what caused it, I came up with it up to you...
 
I hope you can help me.
 
I'm using:
  • MPLAB X IDE v5.25;
  • XC32;
  • Harmony v2.06;
  • PicKit 3;
  • PIC32MX795F512L;
  • LAN8720A.
 
Thanks in advance!
 
Corjan
#1

6 Replies Related Threads

    crosland
    Super Member
    • Total Posts : 1665
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: offline
    Re: Initialization issues 2019/11/07 09:06:14 (permalink)
    +1 (1)
    Read what it says, they are not errors.
     
    Without seeing the source, it's impossible to say what is wrong, other than what those warnings are telling you.
     
    Fix the warnings before you do anything else.
    #2
    Corjan
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2019/10/28 05:24:43
    • Location: 0
    • Status: offline
    Re: Initialization issues 2019/11/07 14:48:30 (permalink)
    0
    Thats the point. I don't know how to fix them. I know it are no errors, but the whole network stuff doesn't work with this warning. 
    What specific source code do you want to see?
    #3
    ric
    Super Member
    • Total Posts : 24202
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Initialization issues 2019/11/07 15:26:16 (permalink)
    +1 (1)
    What is on lines # 507 and 508 in your
    ../src/system_config/YAHOO_SSL/system_init.c
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    Corjan
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2019/10/28 05:24:43
    • Location: 0
    • Status: offline
    Re: Initialization issues 2019/11/08 05:44:05 (permalink)
    0
    It is an array with the network settings:
     

    const TCPIP_NETWORK_CONFIG __attribute__((unused)) TCPIP_HOSTS_CONFIGURATION[] =
    {
    /*** Network Configuration Index 0 ***/
    {
    TCPIP_NETWORK_DEFAULT_INTERFACE_NAME_IDX0, // interface
    TCPIP_NETWORK_DEFAULT_HOST_NAME_IDX0, // hostName
    TCPIP_NETWORK_DEFAULT_MAC_ADDR_IDX0, // macAddr
    TCPIP_NETWORK_DEFAULT_IP_ADDRESS_IDX0, // ipAddr
    TCPIP_NETWORK_DEFAULT_IP_MASK_IDX0, // ipMask
    TCPIP_NETWORK_DEFAULT_GATEWAY_IDX0, // gateway
    TCPIP_NETWORK_DEFAULT_DNS_IDX0, // priDNS
    TCPIP_NETWORK_DEFAULT_SECOND_DNS_IDX0, // secondDNS
    TCPIP_NETWORK_DEFAULT_POWER_MODE_IDX0, // powerMode
    TCPIP_NETWORK_DEFAULT_INTERFACE_FLAGS_IDX0, // startFlags (line 507)
    &TCPIP_NETWORK_DEFAULT_MAC_DRIVER_IDX0, // pMacObject (line 508)
    },
    };

     
    The settings are configured in ...\src\system_config\YAHOO_SSL\system_config.h:
     

    /*** IPv4 Configuration ***/
    /*** Network Configuration Index 0 ***/
    #define TCPIP_NETWORK_DEFAULT_INTERFACE_NAME_IDX0 "PIC32INT"
    #define TCPIP_IF_PIC32INT
    #define TCPIP_NETWORK_DEFAULT_HOST_NAME_IDX0 "YAHOO_SSL"
    #define TCPIP_NETWORK_DEFAULT_MAC_ADDR_IDX0 0
    #define TCPIP_NETWORK_DEFAULT_IP_ADDRESS_IDX0 "192.168.100.115"
    #define TCPIP_NETWORK_DEFAULT_IP_MASK_IDX0 "255.255.255.0"
    #define TCPIP_NETWORK_DEFAULT_GATEWAY_IDX0 "192.168.100.1"
    #define TCPIP_NETWORK_DEFAULT_DNS_IDX0 "192.168.100.1"
    #define TCPIP_NETWORK_DEFAULT_SECOND_DNS_IDX0 "0.0.0.0"
    #define TCPIP_NETWORK_DEFAULT_POWER_MODE_IDX0 "full"
    #define TCPIP_NETWORK_DEFAULT_INTERFACE_FLAGS_IDX0 \
    TCPIP_NETWORK_CONFIG_DHCP_CLIENT_ON |\
    TCPIP_NETWORK_CONFIG_DNS_CLIENT_ON |\
    TCPIP_NETWORK_CONFIG_IP_STATIC
    #define TCPIP_NETWORK_DEFAULT_MAC_DRIVER_IDX0 DRV_ETHMAC_PIC32MACObject
    #define TCPIP_NETWORK_DEFAULT_IPV6_ADDRESS_IDX0 0
    #define TCPIP_NETWORK_DEFAULT_IPV6_PREFIX_LENGTH_IDX0 0
    #define TCPIP_NETWORK_DEFAULT_IPV6_GATEWAY_IDX0 0

    #5
    crosland
    Super Member
    • Total Posts : 1665
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: offline
    Re: Initialization issues 2019/11/08 08:21:26 (permalink)
    +1 (1)
    Did you try googling the warnings? What did you find out?
     
    The first warning tells you you are using an integer where a pointer is expected.
     
    I suspect (but I have zero experience with your code) that you need to assign the value of TCPIP_NETWORK_DEFAULT_INTERFACE_FLAGS_IDX0 to a variable and pass a pointer.
     
    The third warning tells you that you are passing the wrong type of pointer. I can't see the definition of DRV_ETHMAC_PIC32MACObject. Maybe it is already a pointer?
     
    #6
    Corjan
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2019/10/28 05:24:43
    • Location: 0
    • Status: offline
    Re: Initialization issues 2019/11/11 04:10:07 (permalink)
    0
    Did you try googling the warnings? What did you find out?

    Yes, I did. I found some explanations at stackoverflow, but does not understand my code that much... But fortunatly I found the reason of the warning today. I made some changes a while ago, but removed them because I was on the wrong way, but removed not everything.
     

    struct TCPIP_MAC_OBJECT_TYPE;
    // *****************************************************************************
    /* Multi-Homed Hosts Network Addressing Configuration Data
    Summary:
    Defines the data required to initialize the network configuration.
    Description:
    This data type defines the data required to initialize the network configuration
    for a specific interface.
    Remarks:
    IPv4 aliased interfaces can be created by specifying the same MAC object member
    TCPIP_NETWORK_CONFIG.pMacObject.
    An aliased interface is one that shares the same physical interface
    and MAC object with a primary interface.
    Note that the .macAddr is irrelevant for an IPv4 aliased interface.
    The first interface fully configured will be the primary interface, others will
    be aliases.
    An IPv4 alias interface will allow, for example,
    having a different static/dynamic IPv4 address on the same physical interface.
    Note that the stack won't allow initialization of multiple interfaces
    with the same static IPv4 address.
    It is also recommended that each interface has a different host name.
    For an IPv4 alias interface .powerMode == TCPIP_STACK_IF_POWER_DOWN can be used to prevent
    the alias to be started when the stack is initialized and the primary interfaces go up.

    A primary interface currently supports only the TCPIP_STACK_IF_POWER_FULL power mode.
    Alias interfaces are not currently supported on IPv6.
    Currently a broadcast message received (on a primary interface)
    is not duplicated on all aliases but it will appear only on the primary interface.
    */
    typedef struct
    {
    /* Pointer to the interface name; could be NULL. */
    /* Note: Usually it's been one of the TCPIP_STACK_IF_NAME_xxx symbols: */
    /* "ENCJ60", "ENCJ600", "97J60", "PIC32INT", "MRF24WN", "WINC1500", "WILC1000". */
    /* However, the TCP/IP stack will assign an alias names for each interface */
    /* (eth0, wlan0, etc. see TCPIP_STACK_IF_NAME_ALIAS_xxx), so this name is maintained */
    /* for backward compatibility purposes only and will be eventually dropped. */
    /* The native name of the interface in the form TCPIP_STACK_IF_NAME_xxx is */
    /* present in the MAC driver for that interface (see the "tcpip/tcpip_mac_object.h" */
    /* definition of TCPIP_MAC_OBJECT_TYPE). */
    char* interface;
    /* Valid Host name for this interface to use. Ex: "MCHPBOARD" */
    char* hostName;
    /* MAC address to use for this interface. */
    /* Use "00:04:a3:00:00:00" or 0 for the factory preprogrammed address*/
    char* macAddr;
    /* Static IP address to use. Ex: "169.254.1.1"*/
    char* ipAddr;
    /* Netmask to use. Ex: "255.255.0.0"*/
    char* ipMask;
    /* Static Gateway to use. Ex: "169.254.1.1"*/
    char* gateway;
    /* Primary DNS to use. Ex: "169.254.1.1"*/
    char* priDNS;
    /* Secondary DNS to use. Use "0.0.0.0" for none */
    char* secondDNS;
    // /* HTTP username */
    // char* username;
    //
    // /* HTTP password */
    // char* password;

    /* Power Mode to use. Use TCPIP_STACK_IF_POWER_NONE, TCPIP_STACK_IF_POWER_FULL, */
    /* TCPIP_STACK_IF_POWER_LOW, or TCPIP_STACK_IF_POWER_DOWN*/
    char* powerMode;
    /* flags for interface start-up */
    TCPIP_NETWORK_CONFIG_FLAGS startFlags;
    /* Non-volatile pointer to the MAC driver object associated with this network interface */
    /* This is the MAC driver that this interface will use */
    /* Note: This object has to be valid for the whole life of the interface! */
    /* The TCP/IP stack does not make a private copy of this object */
    const struct TCPIP_MAC_OBJECT_TYPE* pMacObject;
    /* static IPv6 address; only if TCPIP_NETWORK_CONFIG_IPV6_ADDRESS specified can be NULL if not needed*/
    char* ipv6Addr;
    /* subnet prefix length; only if TCPIP_NETWORK_CONFIG_IPV6_ADDRESS specified
    0 means default value (64)
    should probably always be 64 as requested by the RFC */
    int ipv6PrefixLen;
    /* default IPv6 gateway address; only if TCPIP_NETWORK_CONFIG_IPV6_ADDRESS specified
    can be NULL if not needed*/
    char* ipv6Gateway;
    }TCPIP_NETWORK_CONFIG;

     
    The (now commented) char * username and char * password was the issue. I think it expected "startFlags" at the 10th place in the struct but then founded "password" with the wrong type. Please correct me if I'm thinking wrong, but anyway, thanks for thinking with me.
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5