Skip to content

Wrong behavior on STM32_ADC_Common when using FeedVoltageSampleToChannel #570

@nandojve

Description

@nandojve

Description

After apply the fixes of renode/renode-infrastructure#94 I tried to use the simulation to run robot to perform the ADC tests. I noted that when using FeedVoltageSampleToChannel the first read is always zero on all channels. It seems that after the second read the simulation consumes the loaded data.

Expected behavior

It is expected that when load a machine and then load data to ADCs when the simulation starts the first read consume the data loaded.

How to reproduce?

1- Apply the fixes of renode/renode-infrastructure#94
2- Build https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/drivers/adc from https://github.com/nandojve/zephyr/tree/renode/fix_stm32_c0g0l0_adc branch
west build -b nucleo_g071rb deps/zephyr/samples/drivers/adc -t run
3- Stop simulation
4- Use the command logged without the "--disable-xwt" and "s" option (note: some zephyr path could be different due to project configurations)
<path>/renode --port -2 --pid-file renode.pid -e '$bin=@<path>/build/zephyr/zephyr.elf; include @<path>/deps/zephyr/boards/arm/nucleo_g071rb/support/nucleo_g071rb.resc;'

5- Feed ADC channels with 1 sample each, start and stop simulation

image

6- Repeat the process and confirm (second time) that simulation always read the first sample as 0 for each channel

image

7- Load more samples and test

image

Environment

Please, provide the following information:

  • Linux debian12 6.1.0-16-amd64
  • Renode, version 1.14.0.26928 (7be2240-202311191610)

Do you plan to address this issue and file a PR?

It is not clear to me why the first sample is not valid. I can send a patch with some help once we figure out the root of cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions