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

FrequencyIO on CircuitPython 7.0.0 only returns 0. Same setup works with 6.3.0. #5643

Closed
FevenKitsune opened this issue Dec 1, 2021 · 2 comments
Assignees
Milestone

Comments

@FevenKitsune
Copy link

FevenKitsune commented Dec 1, 2021

CircuitPython version

Adafruit CircuitPython 7.0.0 on 2021-09-20; Adafruit Feather M4 Express with samd51j19

Code/REPL

# CircuitPython 7.0
import frequencyio
import board
import time

frequency = frequencyio.FrequencyIn(board.D11)

# Loop while printing the detected frequency
while True:
    print(frequency.value)

    # Optional clear() will reset the value
    # to zero. Without this, if the incoming
    # signal stops, the last reading will remain
    # as the value.
    frequency.clear()
    time.sleep(0.1)

Behavior

Signal is generated with an external signal generator (-40.0mV-3.26v Pk-Pk, 1kHz Square Wave).

Serial output with CircuitPython 7.0.0:

0
0
0
0
0
...

Serial output with CircuitPython 6.3.0:

1000
1164
1000
1000
1058
...

Behavior is observed at higher frequencies as well.

Description

No response

Additional information

Did some debugging with @dhalbert on the Adafruit Discord server.

  • Swapped coax cable.
  • Validated normal GPIO operation with pin.
    Oscilloscope 1kHz Bug Report
@FevenKitsune FevenKitsune changed the title FrequencyIO on CircuitPython 7.0 only returns 0. Same setup works with 6.3.0. FrequencyIO on CircuitPython 7.0.0 only returns 0. Same setup works with 6.3.0. Dec 1, 2021
@tannewt tannewt added this to the 7.x.x milestone Dec 1, 2021
@dhalbert
Copy link
Collaborator

dhalbert commented Dec 5, 2021

This appears to be some kind of initialization problem. It works the first time:

[power-cycle]
Adafruit CircuitPython 7.0.0 on 2021-09-20; Adafruit Feather M4 Express with samd51j19
>>> 
>>> import board,frequencyio
>>> frequency = frequencyio.FrequencyIn(board.D11)
>>> frequency.value
529
>>> [ctrl-D]
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Hello World!

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 7.0.0 on 2021-09-20; Adafruit Feather M4 Express with samd51j19
>>> import board,frequencyio
>>> frequency = frequencyio.FrequencyIn(board.D11)
>>> frequency.value
0
>>> 

@dhalbert
Copy link
Collaborator

dhalbert commented Dec 8, 2021

Fixed by #5665.

@dhalbert dhalbert closed this as completed Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants