10000 ports/rp2: Change MICROPY_PY_LWIP setting value and netinfo structure. by irinakim12 · Pull Request #9862 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

ports/rp2: Change MICROPY_PY_LWIP setting value and netinfo structure. #9862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 23 commits into from

Conversation

irinakim12
Copy link
@irinakim12 irinakim12 commented Nov 7, 2022

Issue

  1. Modified the register address area each chip in wiznet5k_regs function
  • When MICROPY_PY_LWIP is set as '0' , it can't read the register value of CREG in wiznet5k_regs function.
  1. Change the location of netinfo structure in the wiznet5k_init function
  2. Delete the define of MICROPY_PY_LWIP in the mpconfigboard.cmake of W5100S_EVB_PICO and W5500_EVB_PICO.
  • When cmake compile, it can't change the value of MICROPY_PY_LWIP

To do

  • When MICROPY_PY_LWIP is set as '1' , it can read the register value of CREG in wiznet5k_regs function.

  • When MICROPY_PY_LWIP is set as '1' and DHCP use ,the operation of assigning IP is very slow.

irinakim12 and others added 11 commits October 18, 2022 09:06
 - When MICROPY_PY_LWIP is set as '1' , it can't read the register value of CREG in wiznet5k_regs function.
    - Change the location of netinfo structure in the wiznet5k_init function
 - Delete the define of MICROPY_PY_LWIP  in the mpconfigboard.cmake of W5100S_EVB_PICO and W5500_EVB_PICO
    - When cmake compile, it can't change the value of MICROPY_PY_LWIP
Delete the define of MICROPY_PY_LWIP in the mpconfigboard.cmake of W5100S_EVB_PICO and W5500_EVB_PICO.
When cmake compile, it can't change the value of MICROPY_PY_LWIP

extmod/network_wiznet5k.c : Change code for WIZNET5K_regs()

Modified the register address area each chip in wiznet5k_regs function
When MICROPY_PY_LWIP is set as '0' , it can't read the register value of CREG in wiznet5k_regs function.
Change the location of netinfo structure in the wiznet5k_init function
extmod/network_wiznet5k.c : Change code for WIZNET5K_regs().
extmod/network_wiznet5k.c:Change the netinfo structure in wiznet5k_init().
Delete the define of MICROPY_PY_LWIP in the mpconfigboard.cmake
of W5100S_EVB_PICO and W5500_EVB_PICO.
When cmake compile, it can't change the value of MICROPY_PY_LWIP
Modified the register address area each chip in wiznet5k_regs function.
When MICROPY_PY_LWIP is set as '0' , it can't read the register value
of CREG in wiznet5k_regs function.
Change the location of netinfo structure in the wiznet5k_init function.
ports/rp2 : change the blank code.
@irinakim12
Copy link
Author
irinakim12 commented Nov 7, 2022

@dpgeorge
I'm not sure why I'm getting the code format error. can you tell me?
and I didn't modify the fileㄴ in the nrf port folder, but an action error occurs. Why?

# Conflicts:
#	extmod/network_wiznet5k.c
Copy link
Member
@jimmo jimmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @irinakim12

The code formatting is failing because it's confused about how the indentation of the preprocessor macros should work. I think this is a bug in how the code format tool works. Either way, if you make my suggested change then the problem will go away anyway.

The nRF build is failing for unrelated reasons. Looks like the soft device downloads are no longer available.

If you have a minute could you also please take a look at Wiznet/ioLibrary_Driver#120 (comment)

@@ -766,7 +768,13 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size
STATIC mp_obj_t wiznet5k_regs(mp_obj_t self_in) {
(void)self_in;
printf("Wiz CREG:");
#if _WIZCHIP_ == 5500
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than duplicating the for loop 3 times, can you do

    #if _WIZCHIP_ == 5500
    const int nregs = 0x50;
    #elif _WIZCHIP_ == 5105
    const int nregs = 0x90;
    #else
    const int nregs = 0x60;
    #endif
    for (int i = 0; i < nregs; ++i) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than having the #else be 0x60 -- can the default be the lower number, and explicitly set it to the higher number when it's known to be a chip with more registers?

@@ -388,6 +379,17 @@ STATIC void wiznet5k_init(void) {
};
wiznet5k_obj.netinfo = netinfo;

// Configure wiznet provided TCP / socket interface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes sense (calling ctlnetwork after actually initialising netinfo), but maybe only the ctlnetwork line needs to move?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right,
In conclusion, after initializing netinfo, call the ctlnetwork function and set the network-related register to the initialized value

netutils_parse_ipv4_addr(items[2], netinfo.gw, NETUTILS_BIG);
netutils_parse_ipv4_addr(items[3], netinfo.dns, NETUTILS_BIG);
ctlnetwork(CN_SET_NETINFO, &netinfo);
netutils_parse_ipv4_addr(items[0], self->netinfo.ip, NETUTILS_BIG);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this change. I think it makes sense, but it would be good to clarify -- is self->netinfo only for DHCP or is it correct to also put the static address into it? What goes wrong if you don't make this change?

@@ -199,6 +199,10 @@ if (MICROPY_PY_LWIP)
target_compile_definitions(${MICROPY_TARGET} PRIVATE
MICROPY_PY_LWIP=1
)
else()
target_compile_definitions(${MICROPY_TARGET} PRIVATE
MICROPY_PY_LWIP=0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be necessary. The default will be zero.

@@ -6,9 +6,14 @@ BOARD ?= PICO

BUILD ?= build-$(BOARD)

LWIP ?= 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense to put this into Makefile. If a board wants to configure LWIP/WizNet then that should be done in mpconfigboard.cmake.

This is an unfortunate detail of the way the CMake system works, but I don't think adding each individual option to the Makefile is the right way to solve it.

@@ -1,4 +1,3 @@
# cmake file for Wiznet W5100S-EVB-Pico.
set(PICO_BOARD wiznet_w5100s_evb_pico)
set(MICROPY_PY_NETWORK_WIZNET5K W5100S)
set(MICROPY_PY_LWIP 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should stay (unless there's some reason we want to stop using LWIP on these boards?) @andrewleech ?

@robert-hh
Copy link
Contributor

If I look at the list of changed files in this PR, almost all of them are not related to the intended change. So something went wrong when making the PR.

@irinakim12
Copy link
Author

Thanks @irinakim12

The code formatting is failing because it's confused about how the indentation of the preprocessor macros should work. I think this is a bug in how the code format tool works. Either way, if you make my suggested change then the problem will go away anyway.

The nRF build is failing for unrelated reasons. Looks like the soft device downloads are no longer available.

If you have a minute could you also please take a look at Wiznet/ioLibrary_Driver#120 (comment)

I will check the pull request!!!

@irinakim12 irinakim12 closed this Nov 15, 2022
@irinakim12 irinakim12 deleted the dev1 branch November 15, 2022 01:39
jepler pushed a commit to pdw-mb/micropython that referenced this pull request Dec 5, 2024
…d-setter

no need to support kwargs in a setter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0