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

Regarding system and RF parameters on esp-open-sdk #255

Open
FlynnMa opened this issue Apr 9, 2017 · 3 comments
Open

Regarding system and RF parameters on esp-open-sdk #255

FlynnMa opened this issue Apr 9, 2017 · 3 comments

Comments

@FlynnMa
Copy link

FlynnMa commented Apr 9, 2017

Seems esp-open-sdk does not load such parameters equal as ESP8266_RTOS_SDK,

In "esp-open-sdk/common.mk", the "bootloader/firmware_prebuilt/blank_config.bin" is hardcoded to flash to 0x1000, while the RF parameter "esp_init_data_default.bin" is not included.

According with documents from ESP8266 "2A-ESP8266__IOT_SDK_User_Manual__EN_v1.3.0.pdf", in section 6.1 mentioned that:
blank.bin shall be programmed to the second section from the end of flash
esp_init_data_default.bin stores default RF parameter values and to be written to the forth sector from the end of flash

The physical address is different according with flash size.

I am very curious that why does esp-open-sdk has this different settings? And the RF parameter is ignored? Does anyone know that?
@pfalcon

@FlynnMa
Copy link
Author

FlynnMa commented Apr 12, 2017

Can anyone please response? Thanks!

@someburner
Copy link

Things have changed since sdk v1.3. The SDK attempts to load the RF calibration data from a sector of flash. Supposedly that should be done automatically if you flash it to the correct sector, but I've never been able to get it to work like that with esp-open-sdk, at least not with my project. The other thing is that init data default has configuration info that may not work for every esp, or you may want to change some of the things.

What I do:

  • Add this PR
  • Add -Wl,--wrap=user_rf_cal_sector_set to your link flags somewhere
  • Then put in user main:
uint32 TEXT_SECTION_ATTR __wrap_user_rf_cal_sector_set(void)
{
   return 1024 - 5; // sector you have rf cal data
}

Also, for init_data_default, I copied the relevant parts from nodemcu. This injects the init_data_default into a known part of the program binary.

@FlynnMa
Copy link
Author

FlynnMa commented Apr 17, 2017

em... interesting, I have found this function under "esp_open_sdk/user_rf_cal_sector_set.c", the default loading sector is to the forth from the end of flash.


`#include <c_types.h>
#include <spi_flash.h>

uint32 user_rf_cal_sector_set(void) {
    extern char flashchip;
    SpiFlashChip *flash = (SpiFlashChip*)(&flashchip + 4);  
    // We know that sector size in 4096
    //uint32_t sec_num = flash->chip_size / flash->sector_size;
    uint32_t sec_num = flash->chip_size >> 12;
    return sec_num - 5;
}
`

BTW, I am very interested in how do you find this function, I tried to search about this on internet for long, but couldn't found a document explain it well. I am still not clear about how do I include it in a project like "esp_open_rtos"?

Thanks very much @someburner .

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

No branches or pull requests

2 participants