Arduino Opta support#531
Conversation
| /* Set pinstrap for 100mbit */ | ||
| // TODO | ||
|
|
||
| /* Reset ETH Phy */ |
There was a problem hiding this comment.
Ah I missed this earlier, oops, but this entire block can be removed. We reset the ethernet phy during its initialization, so as long as you implement EthGetPhyResetPin(), you don't need to touch PJ15 at all!
There was a problem hiding this comment.
I tried removing the reset code but that caused crashes at initialization. Which part did you want removed?
There was a problem hiding this comment.
Huh that's really weird, what was the crash? You should be able to safely remove the following lines:
__HAL_RCC_GPIOJ_CLK_ENABLE();
GPIO_InitTypeDef gpio_eth_rst_init_structure;
gpio_eth_rst_init_structure.Pin = GPIO_PIN_15;
gpio_eth_rst_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
gpio_eth_rst_init_structure.Pull = GPIO_NOPULL;
gpio_eth_rst_init_structure.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOJ, &gpio_eth_rst_init_structure);and then
HAL_Delay(25);
HAL_GPIO_WritePin(GPIOJ, GPIO_PIN_15, 0);
HAL_Delay(100);
HAL_GPIO_WritePin(GPIOJ, GPIO_PIN_15, 1);There was a problem hiding this comment.
I still get an Mbed OS crash (4 long/4 short red LED pattern) when I remove the code above. Can't say for sure what's going on as I only have one Opta device and can't really open it up to attach a debugger.
What's even curiouser is that I found a call to SCB_DisableDCache() in the Arduino mbed-os ethernet init code. When I added that call back in I got TLS to work reliably again (see the top comment on test results). I have no idea what's going on but it doesn't seem right to disable data cache in the ethernet initialization function?
There was a problem hiding this comment.
Hmm what if you keep the GPIOJ clock enable but remove everything else? Or if you just remove the second group of lines?
There was a problem hiding this comment.
@putertubby Any updates on this? If you can check this out, I'm good to merge the PR!
There was a problem hiding this comment.
Haven't had the time to dig further yet. I'll try to look into it. 🤞
|
|
||
| #if !(defined(DUAL_CORE) && defined(CORE_CM4)) | ||
| /* Disable DCache for STM32H7 family */ | ||
| SCB_DisableDCache(); |
There was a problem hiding this comment.
Wait why are we disabling the data cache? This slows the CPU down immensely and shouldn't be needed with the new Mbed CE ethernet drivers
There was a problem hiding this comment.
Ah I saw your other comment. Damn that's annoying that it actually seems to be making a difference with TLS, I thought I fixed this. What code are you running that shows issues with TLS? I think the best path here may be for me to run that code on another STM32H7 board and see if I can reproduce the issues.
There was a problem hiding this comment.
I'll try to create a minimal example. It is quite possible that I made an error in my application code and that issues were masked by the disabled data cache. We'll find out.
Summary of changes
This pull request implements support for the Arduino Opta microPLC by the addition of two public build targets;
ARDUINO_OPTA_M7andARDUINO_OPTA_M4.Documentation
None. The new targets follow the established pattern.
Pull request type
Test results
Tested on an Arduino Opta WIFI M7, nothing running on the M4 yet.
Connection to the server often fails just to succeed in later reconnect attempts. Previous software, using a custom target and based on this version of mbed does not exhibit this behaviour. The only known difference is that I set
"lwip.tcp-mss": 1460inmbed_app.json5in the old software but trying that in this branch fails sanity checks inlwip_init.cso I had to remove the setting. Maybe I'm dropping a lot of packets?