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

Presence of TS_CAL1 on STM32L011 #29

Open
badcf00d opened this issue Nov 25, 2022 · 6 comments
Open

Presence of TS_CAL1 on STM32L011 #29

badcf00d opened this issue Nov 25, 2022 · 6 comments
Assignees
Labels
hal HAL-LL driver-related issue or pull-request. needs clarification Needs clarification or inputs from the user

Comments

@badcf00d
Copy link

The LL API seems to incorrectly assume that TS_CAL1 (temperature sensor calibration value @ 30c) is missing on the STM32L011 series.

The datasheet says in section 6.3.16 Temperature Sensor Characteristics, sub-point 2, "V30 ADC conversion result is stored in the TS_CAL1 byte".

I've tested this on STM32L011 development boards, and the TS_CAL1 value is indeed present in 0x1FF8007A, and the value seems sensible, producing quite accurate temperature readings using the included macro.

Could stm32l0xx_ll_adc.h be modified to correct this? Thanks.

@RJMSTM RJMSTM self-assigned this Dec 6, 2022
@RJMSTM
Copy link
Contributor

RJMSTM commented Dec 26, 2022

Hello @badcf00d

Would you please give us more details about how you got this issue?
Could you please share a screenshot of the value read in addresses 0x1FF8007A (TS_CAL1) or share the project you have used to reproduce the issue in order to allow a better analysis of the problem.

With regards,
Rania

@RJMSTM RJMSTM added the needs clarification Needs clarification or inputs from the user label Dec 26, 2022
@badcf00d
Copy link
Author

badcf00d commented Jan 6, 2023

Hi @RJMSTM

The issue is just that there are multiple comments and #defines in stm32l0xx_ll_adc.h that say that TS_CAL1 isn't available on STM32L011:

/* Note: On device STM32L011, calibration parameter TS_CAL1 is not available. */
#if !defined(STM32L011xx)
#define TEMPSENSOR_CAL1_ADDR ((uint16_t*) (0x1FF8007AU)) /* Internal temperature sensor, address of parameter TS_CAL1: On STM32L0, temperature sensor ADC raw data acquired at temperature 30 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
and
/* Note: On device STM32L011, calibration parameter TS_CAL1 is not available. */
/* Therefore, helper macro __LL_ADC_CALC_TEMPERATURE() is not available.*/
/* Use helper macro @ref __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(). */
/* Note: On device STM32L010xx, temperature sensor is not available. */
/* Therefore, helper macro related to temperature sensor are */
/* not available. */
#if !defined(STM32L011xx) && !defined(STM32L010xB) && !defined(STM32L010x8) && !defined(STM32L010x6) && !defined(STM32L010x4)

But this seems to be incorrect. *((uint16_t*) 0x1FF8007AU) on one of my dev boards is 649, another it's 664, and they both give accurate temperature readings when I remove the #defines and use the __LL_ADC_CALC_TEMPERATURE macro.

So I think the fix is just to remove the comments about TS_CAL1 being unavailable on L011, and remove STM32L011xx from the #defines that I mentioned above.

Thanks,

@ASELSTM ASELSTM added the hal HAL-LL driver-related issue or pull-request. label Apr 18, 2023
@RJMSTM
Copy link
Contributor

RJMSTM commented May 18, 2023

Hello @badcf00d,

Sorry for my tardy reply.
I'm still investigating, as first answer I think the problem is on the datasheet.

I will double check and I will back to you in the next few days.

Regards,

@badcf00d
Copy link
Author

Hi @RJMSTM,

Thanks for getting back to me, like I say it seems like the TS_CAL1 value is present on the L011, all the dev boards I've got give accurate temperature within a couple of degrees when using it. So yeh maybe it's just been left off the datasheet by accident or something.

Regards,

@RJMSTM
Copy link
Contributor

RJMSTM commented Aug 8, 2023

Hello @badcf00d

Please allow me to close this thread as no activity. You may reopen it at any time if you have any details to share with us in order to help you to solve the issue. Thank you for your comprehension.

With regards

@badcf00d
Copy link
Author

badcf00d commented Aug 8, 2023

I don't think this is ready to be closed? This still seems to be a bug in the LL API:

/* Note: On device STM32L011, calibration parameter TS_CAL1 is not available. */

If you would like any more information let me know, but basically, 0x1FF8007AU seems to hold TS_CAL1 on L011, but the LL API is wrong and says TS_CAL1 is not present on L011.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hal HAL-LL driver-related issue or pull-request. needs clarification Needs clarification or inputs from the user
Projects
Development

No branches or pull requests

3 participants