Skip to content

Conversation

@n9wxu
Copy link
Contributor

@n9wxu n9wxu commented Oct 23, 2020

removed extra print statements in the LPC54018 NetworkInterface

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@cobusve cobusve merged commit fbce014 into master Oct 23, 2020
@htibosch
Copy link
Contributor

Calling vTaskNotifyGiveFromISR() without doing a yield, may not result in an immediate wake-up of the receive task rx_task().

+    BaseType_t xSwitchRequired = pdFALSE;
     switch( event )
     {
         case kENET_TxIntEvent:
             break;
         case kENET_RxIntEvent:
             {
                 vTaskNotifyGiveFromISR( receiveTaskHandle, &( xSwitchRequired ) );
+                portEND_SWITCHING_ISR( xSwitchRequired );
             }
             break;
BaseType_t xGetPhyLinkStatus( void )
{
    bool link;

    PHY_GetLinkStatus( &phyHandle, &link );
    return link ? pdTRUE : pdFALSE;
}

Like I said earlier: fetching the link status is expensive, and it may disturb ongoing transfers. It would be better just to return a variable here, and keep the variable up-to-date in the rx_task() by polling the PHY status while there is no reception.
As long as you receive packets, you can safely assume that the PHY link status is high, and no polling is needed.

About xNetworkInterfaceInitialise(): this function will be called until it returns pdPASS.
In your case, it may happen that the initialisation will be done multiple times, until the PHY status is high.

Now your xNetworkInterfaceInitialise() always returns pdTRUE. If there is no link status yet, that would mean that DHCP will fail.

Please have a look at e.g. "STM32Fxx\NetworkInterface.c", in which a variable xMacInitStatus remembers if initialisation has taken place, and if it was successful..

    BaseType_t xResult = pdFAIL;
    if( xMacInitStatus == eMACInit )
    {
        xTXDescriptorSemaphore = xSemaphoreCreateCounting( ( UBaseType_t ) ETH_TXBUFNB, ( UBaseType_t ) ETH_TXBUFNB );
        if( xTXDescriptorSemaphore == NULL )
        {
            xMacInitStatus = eMACFailed;
        }
        else
        {
            xMacInitStatus = eMACPass;
        }
    }
    if( xMacInitStatus != eMACPass )
    {
        /* EMAC initialisation failed, return pdFAIL. */
        xResult = pdFAIL;
    }
    else
    {
        if( xPhyObject.ulLinkStatusMask != 0uL )
        {
            xResult = pdPASS;
            FreeRTOS_printf( ( "Link Status is high\n" ) ) ;
        }
    }
    return xResult;

Mind you: the function xNetworkInterfaceInitialise() is called from the IP-task, while rx_task() is supposed to check the link status.
Make sure that xNetworkInterfaceInitialise() doesn't access the MMI bus, because that code is "non-reentrant".

Hein

@n9wxu n9wxu deleted the cleanNetworkInterface branch October 26, 2020 15:14
AniruddhaKanhere added a commit that referenced this pull request Oct 27, 2020
* Create manifest.yml

* Remove trailing whitespace

* Update manifest.yml

* Corrected a typo

* Add the config file

* Update doxygen and Update some files

* Add the CI check

* Add documentation for doxygen

* Uncrustify

* temp

* Add the files individually

* Update

* Added 2 c files

* Added 2 c files v2

* Added DNS and IP

* Added more comments for doxygen

* Added more comments

* Sockets.c added

* Sockets and TCP_IP

* Added UDP_IP.c

* Remove doxygen output

* Remove a typo

* Spelling corrections

* Some spelling corrections

* Update ci.yml

* Add the TCP_WIN.c file

* Add missing function description

* update lexicon and fix some typos

* Removed duplicates, sort and make lower-case

* Update lexicon

* Uncrustify

* Minor Uncrustify changes

* Update lexicon

* removed extra prints (#48)

* Uncrustify

* Fix conflict resolution issues

* Uncrustify

* Add missing briefs and update based on @htibosch's comments.

* Fix spellings and update lexicon

* uncrustify

* Minor fixes

Co-authored-by: root <[email protected]>
Co-authored-by: Joseph Julicher <[email protected]>
AniruddhaKanhere added a commit that referenced this pull request Oct 27, 2020
* Repair asynchronous DNS lookup (#37)

Co-authored-by: Hein Tibosch <[email protected]>

* WIFINetworkParams_t is changing. Update to conform (#36)

* WIFINetworkParams_t is changing. Update to conform

* uncrustify (v0.66)

Co-authored-by: Aniruddha Kanhere <[email protected]>

* added a network interface for the LPC54018 ethernet (#39)

* added a network interface for the LPC54018 ethernet

Co-authored-by: Joseph Julicher <[email protected]>

* FreeRTOS+TCP Zynq: check frame type before calculating ICMP checksum (v4) (#19)

Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>

* A network driver for Xilinx UltraScale+ 64-bits(v2) (#22)

* A network driver for Xilinx UltraScale+ 64-bits(v2)

* Uncrustify

Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: AniruddhaKanhere <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>

* Adding a network interface for STM32H7xx(v2) (#21)

* Adding a network interface for STM32H7xx(v2)

* Uncrustify

* Uncrustify v2

* Remove trailing whitespace

Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: AniruddhaKanhere <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>

* FreeRTOS+TCP compatibility with 64-bit platforms (v2) (#20)

* FreeRTOS+TCP compatibility with 64-bit platforms (v2)

* Uncrustify

Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>
Co-authored-by: AniruddhaKanhere <[email protected]>

* buffer fixes to the NetworkInterface for the LCP54018 (#41)

* added a network interface for the LPC54018 ethernet

* fixed the buffers so DHCP is now working

* network buffers fixed

* network buffers fixed

Co-authored-by: Aniruddha Kanhere <[email protected]>

* Cleanup as a result of Hein's code review (#43)

* added a network interface for the LPC54018 ethernet

* fixed the buffers so DHCP is now working

* network buffers fixed

* network buffers fixed

* added a network interface for the LPC54018 ethernet

* improvements from Hein's comments, thanks

* final changes based upon Hein's review

* uncrustifying the NetworkInterface.c for LPC54018

Co-authored-by: Aniruddha Kanhere <[email protected]>

* Add spell check (#23)

* Add the spell-check files

* Add lexicon.txt file after generating it.

* Update the allowed name list

* Added some more words to the lexicon

* final revision of additions

* Update ci.yml

* Update ci.yml

* Delete lexicon.txt

* Rename temp.txt to lexicon.txt

* Ignore the portable directory

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update find-unknown-comment-words

* Update ci.yml

* Make all letters lowercase

* Update the lexicon and fix some typos

* Add more details and then add lexicon

* remove spell directory from tools

* Remove duplicate instances and sort the words

* Update lexicon after Gary's comments (and test)

* Update the words list

* Correct word spelling

* Update lexicon.txt

Co-authored-by: Gary Wicker <[email protected]>

* Synchronized the MAC address with main.c

* Uncrustify LPC54018 network interface

* removed extra prints (#48)

* Uncrustify (#44)

* Create manifest.yml

* Remove trailing whitespace

* Update manifest.yml

* Corrected a typo

* Uncrustify C files

* Uncrustify header files

* Update ci.yml

* Update ci.yml

* Uncrustify with version 0.67

* Spelling corrections

* uncrustify run

* - check for pxDuplicateNetworkBufferWithDescriptor returning NULL (#47)

* - check for pxDuplicateNetworkBufferWithDescriptor returning NULL

* Uncrustify the sources

Co-authored-by: Robert Korn <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>
Co-authored-by: AniruddhaKanhere <[email protected]>

* Added CODEOWNERS to require PRBR review (#50)

* Add comments for Doxygen and add doxygen check (#46)

* Create manifest.yml

* Remove trailing whitespace

* Update manifest.yml

* Corrected a typo

* Add the config file

* Update doxygen and Update some files

* Add the CI check

* Add documentation for doxygen

* Uncrustify

* temp

* Add the files individually

* Update

* Added 2 c files

* Added 2 c files v2

* Added DNS and IP

* Added more comments for doxygen

* Added more comments

* Sockets.c added

* Sockets and TCP_IP

* Added UDP_IP.c

* Remove doxygen output

* Remove a typo

* Spelling corrections

* Some spelling corrections

* Update ci.yml

* Add the TCP_WIN.c file

* Add missing function description

* update lexicon and fix some typos

* Removed duplicates, sort and make lower-case

* Update lexicon

* Uncrustify

* Minor Uncrustify changes

* Update lexicon

* removed extra prints (#48)

* Uncrustify

* Fix conflict resolution issues

* Uncrustify

* Add missing briefs and update based on @htibosch's comments.

* Fix spellings and update lexicon

* uncrustify

* Minor fixes

Co-authored-by: root <[email protected]>
Co-authored-by: Joseph Julicher <[email protected]>

Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: David Chalco <[email protected]>
Co-authored-by: Carl Lundin <[email protected]>
Co-authored-by: Joseph Julicher <[email protected]>
Co-authored-by: Gary Wicker <[email protected]>
Co-authored-by: RolinBert <[email protected]>
Co-authored-by: Robert Korn <[email protected]>
Co-authored-by: root <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants