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

support for raspberry pi 4b #8

Open
gpintore82 opened this issue Nov 1, 2019 · 5 comments
Open

support for raspberry pi 4b #8

gpintore82 opened this issue Nov 1, 2019 · 5 comments

Comments

@gpintore82
Copy link

gpintore82 commented Nov 1, 2019

Please add support for it.
I think the error is in PCF8591.py because im getting:
Error. Pi revision didn't recognize, module number: c03111

Thanks!

@ICEFIR
Copy link

ICEFIR commented Nov 2, 2019

Passing bus number to the servo object constructor works on our end.
Something like Servo.Servo(1, bus_number=1)
Also I've added rasp pi 4 model num to PCF8591, I can create a pull request to fix this if its needed?

@gpintore82
Copy link
Author

Hey ICEFIR, thanks for the answer! I made it work adding the the rp4 model number to the PCF8591 too, but i've created the ticket, just in case anyone else needed that :).
Again thanks!

@peta-peta
Copy link

peta-peta commented Jun 2, 2020

Hi, I had the same problem on the Raspberry Pi 4B. I tried to use dragit for sunfounder-PiCar-V. Unfortunately, I got the error message
Error. Pi revision didn't recognize, module number: c03111 Exiting...

I followed the instructions by gpintore82:
If you have installed dragit through dragit_installer.py, you will be able to find dragit installed here /opt/SunFounder_Dragit/Dragit/.

Just modify the file /opt/SunFounder_Dragit/Dragit/Dragit/libs/picar/SunFounder_PCA9685/PCA9685.py and add
RPI_REVISION_4_MODULE_B = ["c03111"]
You will need to include the new version at line 70 and 100, too.

Cheers Peter

RPI_REVISION_0 = ["900092"]
RPI_REVISION_1_MODULE_B = ["Beta", "0002", "0003", "0004", "0005", "0006", "000d", "000e", "000f"]
RPI_REVISION_1_MODULE_A = ["0007", "0008", "0009",]
RPI_REVISION_1_MODULE_BP = ["0010", "0013"]
RPI_REVISION_1_MODULE_AP = ["0012"]
RPI_REVISION_2_MODULE_B = ["a01041", "a21041"]
RPI_REVISION_3_MODULE_B = ["a02082", "a22082"]
RPI_REVISION_3_MODULE_BP = ["a020d3"]
RPI_REVISION_4_MODULE_B = ["c03111"]

_DEBUG = False
_DEBUG_INFO = 'DEBUG "PCA9685.py":'

def _get_bus_number(self):
    pi_revision = self._get_pi_revision()
    if   pi_revision == '0':
        return 0
    elif pi_revision == '1 Module B':
        return 0
    elif pi_revision == '1 Module A':
        return 0
    elif pi_revision == '1 Module B+':
        return 1
    elif pi_revision == '1 Module A+':
        return 0
    elif pi_revision == '2 Module B':
        return 1
    elif pi_revision == '3 Module B':
        return 1
    elif pi_revision == '3 Module B+':
        return 1
    elif pi_revision == '4 Module B':
        return 1


def _get_pi_revision(self):
    "Gets the version number of the Raspberry Pi board"
    # Courtesy quick2wire-python-api
    # https://github.com/quick2wire/quick2wire-python-api
    # Updated revision info from: http://elinux.org/RPi_HardwareHistory#Board_Revision_History
    try:
        f = open('/proc/cpuinfo','r')
        for line in f:
            if line.startswith('Revision'):
                if line[11:-1] in self.RPI_REVISION_0:
                    return '0'
                elif line[11:-1] in self.RPI_REVISION_1_MODULE_B:
                    return '1 Module B'
                elif line[11:-1] in self.RPI_REVISION_1_MODULE_A:
                    return '1 Module A'
                elif line[11:-1] in self.RPI_REVISION_1_MODULE_BP:
                    return '1 Module B+'
                elif line[11:-1] in self.RPI_REVISION_1_MODULE_AP:
                    return '1 Module A+'
                elif line[11:-1] in self.RPI_REVISION_2_MODULE_B:
                    return '2 Module B'
                elif line[11:-1] in self.RPI_REVISION_3_MODULE_B:
                    return '3 Module B'
                elif line[11:-1] in self.RPI_REVISION_3_MODULE_BP:
                    return '3 Module B+'
	    elif line[11:-1] in self.RPI_REVISION_4_MODULE_B:
                    return '4 Module B+'

@NaderOudh98
Copy link

NaderOudh98 commented Oct 8, 2021

it didn't work with me, I did exact same what peta-peta did and it didn't work

@Minemetero
Copy link

my one say a03111, so maybe you meet same be careful with the code it out. Mine is a03111 so it should be a03111 when you change it

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

No branches or pull requests

5 participants