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

Microphone raw output sometimes contains large blocks with value -30584 (0x8888) #377

Open
microbit-carlos opened this issue Sep 19, 2023 · 0 comments
Assignees
Labels
bug Something isn't working p1
Milestone

Comments

@microbit-carlos
Copy link
Collaborator

microbit-carlos commented Sep 19, 2023

And the ADC buffer is pre-filled with value 0x88 in codal-nrf52/source/NRF52ADC.cpp#L436-L446:

    // Fill the buffer with values unused by the ADC hardware. We can use this to perform demuxing 
    // of a live DMA buffer as it is being filled. :)
    // We choose 0x88 as a 16 bit signed 0x8888 is an invalid 14 bit sample (either +ve or -ve)
    b.fill(0x88);

This has been reported by the team working on the factory test programme, and I've struggled a bit to recreate it in a simple/short programme, but managed to make it easier to trigger when the compiler optimisation level is set to -O0 (or whatever is the default in gcc, as the CMAKE Debug build type doesn't set that flag).

The full example can be found here, as it needs changes to build.py to change the build type:

The example contains the following:

  • Changes the CMAKE build type to Debug, so that optimisations are turned off
  • There is a new DataSink connected to the microphone raw output
    • This DataSink simply checks for value -30584 (0x8888) in its pullRequest() and if finds it, it dumps the upstream buffer to serial
  • For the issue to trigger, apart from creating an instance of this DataSink, we also have to set the virtual pin PWM output AND execute the getAnalogValue() from a pin.

On a typical run the serial output continuously prints buffers like this:

pullRequest() number 22111:
pullRequest() number 21799:
6289    6301    6296    6306    6305    6284    6290    6275    6289    6320    6300    6294    6308    6306    6287    6285    
-30584  -30584  -30584  -30584  -30584  -30584  -30584  -30584  -30584  -30584  -30584  -30584  -30584  -30584  -30584  -30584  
6294    6299    6309    6273    6284    6311    6308    6303    6315    6306    6290    6308    6284    6285    6302    6312    
6308    6294    6297    6302    6298    6291    6303    6300    6310    6299    6299    6308    6313    6312    6312    6308    
microbit-carlos added a commit to lancaster-university/microbit-v2-samples that referenced this issue Sep 19, 2023
microbit-carlos added a commit to lancaster-university/microbit-v2-samples that referenced this issue Sep 19, 2023
@microbit-carlos microbit-carlos added this to the v0.2.64 milestone Nov 3, 2023
@microbit-carlos microbit-carlos modified the milestones: v0.2.64, v0.2.65 Nov 14, 2023
@microbit-carlos microbit-carlos added p1 and removed p2 labels Feb 27, 2024
@microbit-carlos microbit-carlos assigned finneyj and unassigned JohnVidler Mar 5, 2024
@microbit-carlos microbit-carlos modified the milestones: v0.2.67, v0.2.68 Mar 26, 2024
@microbit-carlos microbit-carlos added the bug Something isn't working label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p1
Projects
None yet
Development

No branches or pull requests

3 participants