Skip to content
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

Added code that allows programmatically to manage the phy data. #1491

Closed
wants to merge 4 commits into from

Conversation

slaff
Copy link
Contributor

@slaff slaff commented Oct 16, 2018

The initial physical data is used initialize an ESP8266 chip and controls its behaviour. Sometimes you may want to change that data for a certain ROM on the device without changing it for all ROMs on the device.
This PR introduces a new feature that allows programmatically to control and change the initial physical data.

That option is not enabled by default but can be enabled with ENABLE_CUSTOM_PHY=1 directive.

Closes #985.

@slaff slaff added this to the 3.7.0 milestone Oct 16, 2018
@slaff
Copy link
Contributor Author

slaff commented Oct 16, 2018

@tius2000 Any comments or feedback from your side?

int ICACHE_FLASH_ATTR __attribute__((weak)) custom_register_chipv6_phy(uint8_t* initData)
{
if (initData != NULL) {
memcpy(initData, phyInitData, sizeof(phyInitData));
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be memcpy_P?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think that is needed but will test it later just to be sure.

@tius2000
Copy link
Contributor

@slaff : I do not understand the details, but I think that is great idea!

@slaff slaff force-pushed the feature/custom-phy branch from d4228e3 to 9d574df Compare October 21, 2018 22:03
@slaff slaff removed this from the 3.7.0 milestone Oct 25, 2018
@piperpilot
Copy link
Contributor

I will give this a +1 as I didn't realize that the phy data was different between SDKs. I am migrating to 3.0 to fix some stability issues with wifi. So far I haven't seen any major problems with OTA updating to a version of my app on the 3.0 SDK, but I can also say it hasn't really fixed some of the issues I'm seeing. I would say updating the PHY with SDK moving forward would be somewhat required for anyone that has used SMING for a period of time.

@mikee47
Copy link
Contributor

mikee47 commented Aug 11, 2019

@slaff I've been trying to get analogue reading working so tried patching PHY to see if that helped (it doesn't, probably broken hardware). Anyway, I've got this ported onto current develop but not sure best way to submit it.

@slaff
Copy link
Contributor Author

slaff commented Aug 11, 2019

The problem with this PR is that it works only with the latest SDK. If we want to use it for 1.5.4 or 2.0.0 it will not work. There are different tricks to intercept reading or writing to special area on the flash memory but unfortunately I was not able to find a solution that works on all supported SDKs.

We can eventually say that this will work only with SDK >= 3.0.0.

Anyway, I've got this ported onto current develop but not sure best way to submit it

Submit your code as a new PR and I will close this one.

@mikee47
Copy link
Contributor

mikee47 commented Aug 11, 2019

OK, thanks.

@mikee47
Copy link
Contributor

mikee47 commented Aug 11, 2019

You might find this funny. I had signal connected to D0 instead of A0 on my nodeMCU. Shoot me now :-(

@mikee47
Copy link
Contributor

mikee47 commented Feb 10, 2021

@slaff With #2171 changing the PHY could be done by adding a build variable with the partition name for the PHY initialisation data (default would be phy_init) so it gets picked up in user_pre_init. Would that be sufficient to achieve the goals for this PR?

(NB. This still leaves the issue of how to construct the PHY data but with a HEX editor and the Official configuration guide not too difficult. If there's a need could be handled using a python script, with the configuration described in a JSON file.)

@mikee47 mikee47 force-pushed the develop branch 2 times, most recently from 7b19c1b to 295a5f3 Compare February 22, 2021 15:50
@mikee47 mikee47 force-pushed the feature/custom-phy branch 2 times, most recently from 308f912 to 9d574df Compare June 23, 2024 13:15
@mikee47
Copy link
Contributor

mikee47 commented Jun 23, 2024

Closing in favour of #2830

@mikee47 mikee47 closed this Jun 23, 2024
slaff pushed a commit that referenced this pull request Jun 24, 2024
The initial PHY data is used initialize an ESP8266 chip and controls its behaviour.
This is stored in the ``phy_init`` partition and is loaded at startup.

Sometimes you may want to change that data for a certain ROM on the device without changing it for all ROMs on the device.

To do this, build with ``ENABLE_CUSTOM_PHY=1`` and add code to your application:

```
#include <esp_phy.h>

void customPhyInit(PhyInitData data)
{
   // Use methods of `data` to modify as required
 data.set_vdd33_const(0xff);
}
```

This PR supersedes #1491 and provides a more C++ mechanism for adjusting the configuration at runtime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants