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

First step at supporting aiy-voicebonnet #13

Closed
wants to merge 2 commits into from

Conversation

builderjer
Copy link
Member

  • respeaker 4mic and 6mic i2c numbers reversed
  • fixed i2cdetect command with bus number

- respeaker 4mic and 6mic i2c numbers reversed
- fixed  command with bus number
@JarbasAl JarbasAl requested a review from j1nx March 13, 2023 15:29
Copy link
Member

@j1nx j1nx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. If this is tested and works (flipping 4mic and 6mic), then I have the same mistake on buildroot OS level;
https://github.com/OpenVoiceOS/ovos-buildroot/blob/develop/buildroot-external/board/raspberrypi/rootfs-overlay/usr/libexec/ovos-i2csound

I do not have a voicebonnet, so can't check that code. I do have the Chatterbox bonnet but that one is undetectable.

@builderjer What is needed on an OS level to configure that HAT? Then I can add the bonnet to the above script as well.

@builderjer
Copy link
Member Author

I have the voicebonnet and a 4-mic respeaker to test with. soon a voice hat also and will add that detection.

The voicebonnet needs drivers from this fork of aiyprojects. I got the speaker and mic to work pretty easy, and have been working on the LED button. a multi-colored led on the bonnet, not sure of the hat yet. I needed to change permissions somewhere though. Viraniac also made a deb file for the bonnet which was nice of him. https://github.com/viraniac/aiy-voicebonnet-soundcard-dkms/releases/tag/3.0-1.1-beta

@builderjer
Copy link
Member Author

just got the voicehat v1. It does not register with i2cdetect, but it does work with just the overlay googlevoicehat-soundcard. So I won't be adding any additions to this PR unless the testing shows something to be wrong

@j1nx
Copy link
Member

j1nx commented Mar 17, 2023

So, the v2 hat can be detected, the v1 cannot?

I can confirm the v1, however do not have a v2 to test.

@builderjer
Copy link
Member Author

Yes, that is correct. My V1 is NOT detected with i2cdetect, but the V2 bonnet is. I only added the mic detection, it also shows the speaker and the led in the i2c bus. I can add those if you want.

@viraniac
Copy link

Yes, that is correct. My V1 is NOT detected with i2cdetect, but the V2 bonnet is. I only added the mic detection, it also shows the speaker and the led in the i2c bus. I can add those if you want.

Incase you are feeling brave enough to enable autodetection for Voice Hat v1, please follow the instructions provided here

@builderjer
Copy link
Member Author

Hmmm, maybe I will try that with mine, and then at least we can write the code to support this. Then if anybody wants to do so, they can.

@viraniac
Copy link

Out of curiosity and I might be missing the bigger picture here, but why are you using i2cdetect to check whether aiy voice_bonnet is connected or not? Cant you use the contents of /proc/device-tree/hat/product file?

@builderjer
Copy link
Member Author

I was emulating the code that was written for other devices. I will check that when I hook one up again. Thanks for the tip

@JarbasAl
Copy link
Member

JarbasAl commented Mar 31, 2023

/proc/device-tree/hat/

this only works after the dtoverlay is added to boot/config.txt right?

we want to detect this before that step, to automatically configure whatever is needed, but @j1nx is the one to explain better the constraints

edit: see here OpenVoiceOS/community-docs#49 (comment)

@viraniac
Copy link

this only works after the dtoverlay is added to boot/config.txt right?

As far as I can recall and assuming my understanding is correct, dtoverlay has nothing to do with it. I believe it is populated by the raspberrypi's bootloader after reading the hat's eeprom. The eeprom may or may not contain the dtoverlay dtb. Like in case of voice-hat v1, it doesn't contain the dtb and hence we manually have to add the dtoverlay. But even before adding dtoverlay manually, the /proc/device-tree/hat directory will exist if the raspberrypi bootloader was able to read the eeprom

@builderjer
Copy link
Member Author

I have the voice hat v1 installed right now on a pi3b, and /proc/device-tree/hat is not there. I checked before I added the dtoverlay, and after. I does not show up there. Is that because I did not flash the hat, (yet), like in your HACKING.md.

@viraniac
Copy link

viraniac commented Mar 31, 2023 via email

@builderjer
Copy link
Member Author

no force_eeprom_read or disable_poe_fan, I just used the original HACKING.md instructions for installing it, and it works good. I just can't detect it. Should I add one of those?

As for what os? It is a custom raspbian image built with pi-gen

cat /boot/config.txt 
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
#dtparam=audio=on

# Automatically load overlays for detected cameras
camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Run in 64-bit mode
arm_64bit=1

# Disable compensation for displays with overscan
disable_overscan=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[all]

[pi4]
# Run as fast as firmware / board allows
arm_boost=1

[all]

[pi0]
arm_64bit=0

[all]

dtoverlay=googlevoicehat-soundcard

@viraniac
Copy link

viraniac commented Mar 31, 2023 via email

@builderjer
Copy link
Member Author

builderjer commented Mar 31, 2023

no, just the voice hat v1

cat /proc/device-tree/hat
cat: /proc/device-tree/hat: No such file or directory

@viraniac
Copy link

viraniac commented Mar 31, 2023 via email

@builderjer
Copy link
Member Author

@builderjer builderjer closed this Apr 1, 2023
@builderjer builderjer reopened this Apr 1, 2023
@viraniac
Copy link

viraniac commented Apr 1, 2023

eeprom backup https://drive.google.com/file/d/1nGzSZzK5WWif0CS_NRa-SZ3xSXr505QU/view?usp=sharing

This is weird. Your eeprom is completely empty. Mine had the hat metadata present in it. Here is my stock eeprom image for comparision

@builderjer
Copy link
Member Author

I think I will flash like your instructions describe and see what shows up then. Ya, mine was unreadable, I thought it was supposed to be that way. It'll be later today though

Copy link

codecov bot commented Dec 3, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (60ff162) 0.00% compared to head (8c2f42c) 0.00%.
Report is 1 commits behind head on dev.

Files Patch % Lines
ovos_PHAL/detection.py 0.00% 12 Missing ⚠️
ovos_PHAL/version.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             dev     #13   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          6       6           
  Lines        163     169    +6     
=====================================
- Misses       163     169    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@builderjer
Copy link
Member Author

Not sure why the build tests are still failing, but without this, the ReSpeaker 4mic and 6mic are reversed, and will be configured wrong on boot, and by the PHAL plugin associated with them.

@builderjer
Copy link
Member Author

Closing this as there is ovos-i2cdetect now

@builderjer builderjer closed this Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants