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

Adding support for 12Mhz crystal oscillator in __init__.py #26

Open
srolf opened this issue Aug 16, 2024 · 1 comment
Open

Adding support for 12Mhz crystal oscillator in __init__.py #26

srolf opened this issue Aug 16, 2024 · 1 comment

Comments

@srolf
Copy link

srolf commented Aug 16, 2024

Please add in init.py support for a crystal oscillator running at 12Mhz.

I would like to use on a WaveShare RP2040-PiZero with a WaveShare RS485 CAN HAT for Raspberry Pi which uses a 12Mhz oscillator. This HAT exists in two variants, one with 8Mhz and one with 12Mhz.

@srolf
Copy link
Author

srolf commented Aug 16, 2024

As mentioned in the code, I used the CAN bus timing calculator and inserted before the 10Mhz definition the following:

    # 12MHz Crystal oscillator (used on the WaveShare RS485 CAN HAT)
    12000000: {
        #        CNF1, CNF2, CNF3
        1000000: (0x00, 0x88, 0x01),
        500000: (0x00, 0x9A, 0x03),
        250000: (0x00, 0xBF, 0x06),
        200000: (0x02, 0x92, 0x02),
        125000: (0x01, 0xBF, 0x06), 
        100000: (0x02, 0xB5, 0x05),
    },

and was able to receive frames with correct data on a RPi5 with a CAN-USB dongle (USB ID 1d50:606f) at 500K and 1M.

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

1 participant