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

set_boost oversight? #47

Closed
tottaka opened this issue Nov 15, 2023 · 12 comments · Fixed by #48
Closed

set_boost oversight? #47

tottaka opened this issue Nov 15, 2023 · 12 comments · Fixed by #48
Assignees

Comments

@tottaka
Copy link

tottaka commented Nov 15, 2023

def set_boost(self, setting: int) -> None:

The datasheet for RFM69 says to set two different values for RegTestPa1 and RegTestPa2 when enabling boost, but currently they are set as the same value in the set_boost function which doesn't seem right.

image

@jerryneedell
Copy link
Contributor

hmm -- it looks like I introduced this error with PR #44
I'll try to look into fixing it, or you are welcome to submit a PR to fix it if you want.

The changes were made when we were trying to reduce the code size as much as possible and it looks like I got a bit carried away here.

Any changes must be tested on the small build for the feather_m0_rfm69 board to make sure it still fits...

@jerryneedell
Copy link
Contributor

jerryneedell commented Nov 15, 2023

Reviewing the data sheet, it does not appear that the RegOCP value is being handled properly for the High Power settings either.
"Notes

  • To ensure correct operation at the highest power levels, please make sure to adjust the Over Current Protection Limit accordingly in RegOCP, except above +18dBm where it must be disabled"

This is from section 3.3.6 of https://cdn-shop.adafruit.com/product-files/3076/RFM69HCW-V1.1.pdf
but in the next section 3.3.7 it suggests setting the RegOCP to 0x0f not disabled.

This is confusing. I will compare this to the RadioHead Library implementation.

@jerryneedell
Copy link
Contributor

Ah -- setting the RegOCP to 0x0F as per the Datasheet does disable the OCP but reviewing the RadioHead library for Arduino, it does not appear that this is implemented there either. RegOCP is always left at the default setting of 0x1A, even for High Power operation. This does not appear to be correct but I am not sure what impact it has. I'll raise this question in their forum as well.

@jerryneedell
Copy link
Contributor

The documentation in https://cdn-shop.adafruit.com/product-files/3076/sx1231.pdf is a bit different. See section 3.4.7
There is no mention of disabling the OCP for high power....

@jerryneedell jerryneedell self-assigned this Nov 15, 2023
@tottaka
Copy link
Author

tottaka commented Nov 17, 2023

The documentation in https://cdn-shop.adafruit.com/product-files/3076/sx1231.pdf is a bit different. See section 3.4.7 There is no mention of disabling the OCP for high power....

Interesting, maybe I have been looking at the wrong datasheet. I just got mine off the first google result I saw. Please do update me with your changes as I have ported this library to C# and will definitely want to update my code accordingly.

I was considering changing the method (in C#) like so:

void SetBoost(bool enable_boost)
{
	if(enable_boost)
	{
		WriteRegister(RegisterAddress.PA1, 0x5D);
		WriteRegister(RegisterAddress.PA2, 0x7C);
	}
	else
	{
		WriteRegister(RegisterAddress.PA1, 0x55);
		WriteRegister(RegisterAddress.PA2, 0x70);
	}
}

If you would like I can also look further into it as well and submit a PR for the Python code if you can't be bothered

@tottaka
Copy link
Author

tottaka commented Nov 17, 2023

Ah -- setting the RegOCP to 0x0F as per the Datasheet does disable the OCP but reviewing the RadioHead library for Arduino, it does not appear that this is implemented there either. RegOCP is always left at the default setting of 0x1A, even for High Power operation. This does not appear to be correct but I am not sure what impact it has. I'll raise this question in their forum as well.

Can you post the forum link for your question so I can read it as well?

Reading back, this seems to be an oversight on the RadioHead library as well. There is a note in section 3.3.7 of https://cdn-shop.adafruit.com/product-files/3076/RFM69HCW-V1.1.pdf that states High Power settings MUST be turned off when using PA0, and in Receive mode.

Note: I also have an Adafruit Feather M0 Radio with RFM69 Packet Radio so let me know if you want me to run some tests. I'm using this on a Raspberry Pi, but I understand the need for very efficient code on smaller devices.

@jerryneedell
Copy link
Contributor

I have implemented a fix for this and fixed up some other issues regarding the power level reporting. I will do a bit more testing and should have a PR ready this weekend. IF you want a "sneak peak" you can find the working code here
https://github.com/jerryneedell/Adafruit_CircuitPython_RFM69/blob/jerryn_power/adafruit_rfm69.py

There was an existing error in the way tx_power was being returned. I think I have fixed that now as well.
I also added code to disable the Overload Current Protection (RegOCP) for tx_power >18 as specified in the Datasheet.

@jerryneedell
Copy link
Contributor

@tottaka I would certainly appreciate it if you can test my changes and see if you agree with them.

@jerryneedell
Copy link
Contributor

@tottaka I will go ahead and create a PR for this so you can more easily review an comment on it

@jerryneedell
Copy link
Contributor

@tottaka please review and comment on #48

@jerryneedell
Copy link
Contributor

@tottaka FYI -- I posted this to the radiohead-ardupino forum https://groups.google.com/g/radiohead-arduino/c/tRn1sibn82o

@tottaka
Copy link
Author

tottaka commented Nov 19, 2023

@tottaka please review and comment on #48

Looks okay to me, thank you for the quick support!

@tottaka tottaka closed this as completed Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants