-
Notifications
You must be signed in to change notification settings - Fork 3k
[WIZnet][W7500*] Support for mbed OS 5 #4226
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
Conversation
Modifying the code for mbed ci shield test -> analogin_api.c, W7500x_adc.c, gpio_irq_api.c, W7500x_gpio.c Modifying the code for fix bug -> W7500x_uart.c(register control driver problem), W7500x_uart.h, pinmap.c(pullup, pulldown problem)
Hi, I am the Partner Enablement Korea lead for WIZnet. Please let me know how we can expedite this process. Thanks, |
@@ -42,6 +42,7 @@ void ADC_InterruptClear (void) | |||
void ADC_Init (void) | |||
{ | |||
// ADC_CLK on | |||
ADC_PowerDownEnable(ENABLE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep the indentation 4 spaces as it was (or this might be a tab ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifications completed
@@ -119,15 +119,31 @@ void pin_mode(PinName pin, PinMode pupd) | |||
|
|||
switch(port_num) { | |||
case PortA: | |||
if(pupd != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
if () {
}
as the rest of this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifications completed
@@ -110,10 +119,11 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32 | |||
else | |||
obj->irq_n = PORT3_IRQn; | |||
|
|||
//obj->event = EDGE_FALL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove any "dead" code like this, same o nthe line 109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifications completed
port_generic_handler(GPIOA, 0); | ||
test_tmp++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test variable that should be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifications completed
@@ -58,11 +58,11 @@ void analogin_init(analogin_t *obj, PinName pin) | |||
obj->pin = pin; | |||
|
|||
// The ADC initialization is done once | |||
if (adc_inited == 0) { | |||
//if (adc_inited == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
second ADC pin will reinit entire ADC? What is this change fixing? What was wrong with the previous version?
For future reference, It would be beneficial if any logical change would have separate commit, like this one, would be explained via commit message why and what has changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problems occurred when Two or more pins were used...
So we modified this code.
It would be good to share test results from I left few comments, mostly style related. Note, we are soon enough going to land new RTX2 to master. |
- deleted dead code - deleted test code
modified this issues |
This is the test result log. WIZnet_W7500_test_logs.zip |
@@ -119,7 +114,6 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32 | |||
else | |||
obj->irq_n = PORT3_IRQn; | |||
|
|||
obj->event = EDGE_NONE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this event removed? it's a style commit, but this is functional change? or dead code not used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, It is a mistake. I put it back.
@@ -141,10 +145,14 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) | |||
obj->rise_null = 0; | |||
} | |||
else if (event == IRQ_FALL) { | |||
gpio->INTPOLSET &= ~obj->pin_index; | |||
//gpio->INTPOLSET &= ~obj->pin_index; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still dead code in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifications completed
case PortA: | ||
if(pupd != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
if () {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifications completed
Thanks for sharing the test results, all fine!
What is with RTC and PWM? Out of curiosity. I left 2 minor comments, once reviewed, I'll run CI. |
RTC: Real Time Clock. For accurate time application like digital clock or constant blip. |
modified coding style. -> pinmap.c
All edited. |
My question above was why RTC and PWM are waived - what will be added to the board page? The reason |
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
|
targets/targets.json
Outdated
@@ -2460,7 +2460,7 @@ | |||
"supported_toolchains": ["uARM", "ARM"], | |||
"inherits": ["Target"], | |||
"device_has": ["ANALOGIN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SPI", "SPISLAVE", "STDIO_MESSAGES"], | |||
"release_versions": ["2"] | |||
"release_versions": ["2", "5"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must support ARM, GCC_ARM, and the IAR compilers to enable the release version "5" (same goes for the below changes). That's why the CI failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No... We don't have time to support GCC_ARM and IAR.
It supports ARM compiler only for now.
We have May 1st contest coming.
Let me call you and others internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked WIZnet to change the supported toolchains. Let's see how this goes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added support for GCC and IAR.
RTC:
PWM:
About the Feature Documentation:
|
Please ignore my comment about "urgency". I think we can relax and do this PR properly with time. :) |
Added support for GCC and IAR. |
Awesome, thanks for adding that! I'll run the CI again. /morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputBuild failed! |
@khj098765 From the Ci above, you can review the logs with errors. One of them: ```[Fatal Error] RTX_Conf_CM.c@54,0: [Pe035]: #error directive: "no target defined"```` . Can you please test ? I would run |
targets/TARGET_WIZNET/mbed_rtx.h
Outdated
#define OS_CLOCK 20000000 | ||
#endif | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build is failing because of this extra #endif
I believe!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This should be moved to line 66.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khj098765 Can you update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed and updated this issue.
WIZnet is on vacation for this whole week. So they will be able to respond on next Monday. Justin, @khj098765, our team did the review of GCC_ARM and I got this comment. Please review. Their startup code of GCC_ARM needs to call _start function in GCC runtime (then, the _start function calls main function).
This is explained here: And similar issue raised here: Also, I recommend to remove *.o file to avoid multiple link errors. |
Could we get a better name for this? "modify the code to support" is always happening. |
I'm sorry I keep repeating. |
@khj098765, Justin, could you please change the title to "[WIZnet][W7500*] Support for mbed OS 5"? Or you can improvise as you wish. :) |
/morph test |
Yes I can change title to "[WIZnet][W7500*] Support for mbed OS 5" |
/morph test |
ADC_Init(); | ||
} | ||
// The ADC initialization | ||
ADC_Init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I asked earlier but cant find my comment. Why are you removing this static init variable? If I have 2 pins, this will reinit ADC 2x (power down and up as I can see in this changeset)? Is this desirable behavior? what was wrong with code as it was?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I talked with WIZnet Justin and he said this
- Previously it worked fine. They thought ADC_Init() can be done only once and that was how it was implemented.
- During the CI ADC test, they found that previous ADC run had some 'lingering effect'.
- Now they realized that ADC should be hardware reset, which is done by calling ADC_Init() all the time when actual init is happening.
- This code is now better and more intuitive and correctly resets the ADC hardware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, hw reset peripheral for each ADC pin. If this is their hw requirement to restart adc like that for each adc channel initialization, ok.
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
@andrewc-arm happy with this patch as it is now? @khj098765 Can you please answer ADC question above |
Yes. But let me clear the ADC question you raised, I will talk to Justin why it was that way before and why it is this way now. I just posted the reason for the ADC code change and I think this can be patched? :) |
Could you let us know when this will be merged to mbed-os repo? The WIZnet contest makers are waiting. :) |
@andrewc-arm We will review this as a candidate for inclusion in mbed OS on Monday, May 15th. Sorry for the wait. |
Description
For support mbed OS 5 PR
Modifying the code for mbed ci shield test -> analogin_api.c, W7500x_adc.c, gpio_irq_api.c, W7500x_gpio.c
Modifying the code for fix bug -> W7500x_uart.c(register control driver problem), W7500x_uart.h, pinmap.c(pullup, pulldown problem)
Status
READY
Migrations
NO