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

cyw43 on rp pico 2 w #3612

Open
rztz opened this issue Dec 5, 2024 · 2 comments
Open

cyw43 on rp pico 2 w #3612

rztz opened this issue Dec 5, 2024 · 2 comments

Comments

@rztz
Copy link

rztz commented Dec 5, 2024

The same code runs on rp2040 with cyw43, but dies on rp2350 with cyw43.
On rp2350 it panics at bp_read addr is not dividable by 4.

Disabling firmware-logs skips this code, but the module also does not work.
It reports something like 'TX stalled' or 'len inv mismatch'

Compare the following trace dumps side by side:

rp2350:
0.001596 WARN main()
0.001224 TRACE WL_REG off/on
0.271306 TRACE read REG_BUS_TEST_RO
0.271393 TRACE 0x3030303
0.271438 TRACE 0xfeedbead
0.271459 TRACE write REG_BUS_TEST_RW
0.271587 TRACE 0x12345678
0.271610 TRACE read REG_BUS_CTRL
0.271643 TRACE 0b00110000
0.271662 TRACE write REG_BUS_CTRL
0.271692 TRACE read REG_BUS_CTRL
0.271756 TRACE 0b10110001
0.271776 TRACE read REG_BUS_TEST_RO
0.271818 TRACE 0xfeedbead
0.271841 TRACE read REG_BUS_TEST_RW
0.271877 TRACE 0x12345678
0.271901 TRACE write SPI_RESP_DELAY_F1 CYW43_BACKPLANE_READ_PAD_LEN_BYTES
0.271944 TRACE Make sure error interrupt bits are clear
0.271972 TRACE enable a selection of interrupts
0.272008 DEBUG init alp
0.272038 DEBUG set f2 watermark
0.272093 DEBUG watermark = 10
0.272112 DEBUG waiting for clock...
0.272152 DEBUG clock ok
0.272164 DEBUG clear request for ALP
0.272200 TRACE backplane_readn addr = 18000000 len = 2
0.272301 TRACE backplane_readn addr = 18000000 len = 2 val = 2d85a9af
0.272340 DEBUG chip ID: 43439
0.272376 TRACE backplane_readn addr = 18103800 len = 1
0.272436 TRACE backplane_readn addr = 18103800 len = 1 val = 2d850001
0.272479 TRACE backplane_readn addr = 18103800 len = 1
0.272523 TRACE backplane_readn addr = 18103800 len = 1 val = 2d850001
0.272566 TRACE backplane_readn addr = 18104800 len = 1
0.272608 TRACE backplane_readn addr = 18104800 len = 1 val = 2d850001
0.272643 TRACE backplane_readn addr = 18104800 len = 1
0.272687 TRACE backplane_readn addr = 18104800 len = 1 val = 2d850001
0.272729 TRACE backplane_readn addr = 18104800 len = 1
0.272772 TRACE backplane_readn addr = 18104800 len = 1 val = 2d850001
0.272805 TRACE backplane_readn addr = 18104800 len = 1
0.272848 TRACE backplane_readn addr = 18104800 len = 1 val = 2d850001
0.272891 TRACE backplane_writen addr = 18104408 len = 1 val = 00000003
0.272955 TRACE backplane_readn addr = 18104408 len = 1
0.273000 TRACE backplane_readn addr = 18104408 len = 1 val = 2d850003
0.273036 TRACE backplane_writen addr = 18104800 len = 1 val = 00000000
0.274095 TRACE backplane_writen addr = 18104408 len = 1 val = 00000001
0.274157 TRACE backplane_readn addr = 18104408 len = 1
0.274211 TRACE backplane_readn addr = 18104408 len = 1 val = 2d850001
0.275268 TRACE backplane_writen addr = 18004010 len = 4 val = 00000003
0.275336 TRACE backplane_writen addr = 18004044 len = 4 val = 00000000
0.275383 DEBUG loading fw
0.275406 TRACE bp_write addr = 00000000
0.392831 DEBUG loading nvram
0.392864 TRACE bp_write addr = 0007fd10
0.393312 TRACE backplane_writen addr = 0007fffc len = 4 val = ff4400bb
0.393374 DEBUG starting up core...
0.393407 TRACE backplane_readn addr = 18103800 len = 1
0.393546 TRACE backplane_readn addr = 18103800 len = 1 val = 2d850001
0.393594 TRACE backplane_readn addr = 18103800 len = 1
0.393639 TRACE backplane_readn addr = 18103800 len = 1 val = 2d850001
0.393683 TRACE backplane_writen addr = 18103408 len = 1 val = 00000003
0.393737 TRACE backplane_readn addr = 18103408 len = 1
0.393783 TRACE backplane_readn addr = 18103408 len = 1 val = 2d850003
0.393819 TRACE backplane_writen addr = 18103800 len = 1 val = 00000000
0.394890 TRACE backplane_writen addr = 18103408 len = 1 val = 00000001
0.394952 TRACE backplane_readn addr = 18103408 len = 1
0.395008 TRACE backplane_readn addr = 18103408 len = 1 val = 2d850001
0.396062 TRACE backplane_readn addr = 18103408 len = 1
0.396113 TRACE backplane_readn addr = 18103408 len = 1 val = 2d850001
0.396153 TRACE backplane_readn addr = 18103800 len = 1
0.396198 TRACE backplane_readn addr = 18103800 len = 1 val = 2d850000
0.396235 DEBUG wait for HT clock
0.414516 DEBUG setup interrupt mask
0.414534 TRACE backplane_writen addr = 18002024 len = 4 val = 000000f0
0.414596 DEBUG bluetooth setup interrupt mask
0.414613 TRACE backplane_writen addr = 18002024 len = 4 val = 00000020
0.414701 DEBUG waiting for F2 to be ready...
0.500059 DEBUG clear pad pulls
0.500135 DEBUG waiting for HT clock...
0.500175 DEBUG clock ok
0.500199 TRACE backplane_readn addr = 0006fffc len = 4
0.500282 TRACE backplane_readn addr = 0006fffc len = 4 val = 0001ff7e
0.500317 DEBUG shared_addr 0001ff7e
0.500352 TRACE bp_read addr = 0001ff7e
0.500377 ERROR panicked at 'assertion failed: addr % 4 == 0'
0.500399 ERROR panicked at /home/ztz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/defmt-0.3.10/src/lib.rs:380:5:
explicit panic

rp2040:
0.002536 WARN main()
0.001805 TRACE WL_REG off/on
0.271952 TRACE read REG_BUS_TEST_RO
0.272092 TRACE 0x3030303
0.272171 TRACE 0xfeedbead
0.272206 TRACE write REG_BUS_TEST_RW
0.272383 TRACE 0x12345678
0.272422 TRACE read REG_BUS_CTRL
0.272473 TRACE 0b00110000
0.272502 TRACE write REG_BUS_CTRL
0.272545 TRACE read REG_BUS_CTRL
0.272627 TRACE 0b10110001
0.272658 TRACE read REG_BUS_TEST_RO
0.272717 TRACE 0xfeedbead
0.272753 TRACE read REG_BUS_TEST_RW
0.272806 TRACE 0x12345678
0.272841 TRACE write SPI_RESP_DELAY_F1 CYW43_BACKPLANE_READ_PAD_LEN_BYTES
0.272908 TRACE Make sure error interrupt bits are clear
0.272955 TRACE enable a selection of interrupts
0.273019 DEBUG init alp
0.273066 DEBUG set f2 watermark
0.273147 DEBUG watermark = 10
0.273173 DEBUG waiting for clock...
0.273228 DEBUG clock ok
0.273247 DEBUG clear request for ALP
0.273303 TRACE backplane_readn addr = 18000000 len = 2
0.273474 TRACE backplane_readn addr = 18000000 len = 2 val = 0feaa9af
0.273536 DEBUG chip ID: 43439
0.273587 TRACE backplane_readn addr = 18103800 len = 1
0.273683 TRACE backplane_readn addr = 18103800 len = 1 val = 0fea0001
0.273745 TRACE backplane_readn addr = 18103800 len = 1
0.273818 TRACE backplane_readn addr = 18103800 len = 1 val = 0fea0001
0.273885 TRACE backplane_readn addr = 18104800 len = 1
0.273961 TRACE backplane_readn addr = 18104800 len = 1 val = 0fea0001
0.274014 TRACE backplane_readn addr = 18104800 len = 1
0.274092 TRACE backplane_readn addr = 18104800 len = 1 val = 0fea0001
0.274157 TRACE backplane_readn addr = 18104800 len = 1
0.274230 TRACE backplane_readn addr = 18104800 len = 1 val = 0fea0001
0.274283 TRACE backplane_readn addr = 18104800 len = 1
0.274354 TRACE backplane_readn addr = 18104800 len = 1 val = 0fea0001
0.274423 TRACE backplane_writen addr = 18104408 len = 1 val = 00000003
0.274524 TRACE backplane_readn addr = 18104408 len = 1
0.274595 TRACE backplane_readn addr = 18104408 len = 1 val = 0fea0003
0.274654 TRACE backplane_writen addr = 18104800 len = 1 val = 00000000
0.275745 TRACE backplane_writen addr = 18104408 len = 1 val = 00000001
0.275838 TRACE backplane_readn addr = 18104408 len = 1
0.275911 TRACE backplane_readn addr = 18104408 len = 1 val = 0fea0001
0.276989 TRACE backplane_writen addr = 18004010 len = 4 val = 00000003
0.277097 TRACE backplane_writen addr = 18004044 len = 4 val = 00000000
0.277168 DEBUG loading fw
0.277199 TRACE bp_write addr = 00000000
0.458455 DEBUG loading nvram
0.458499 TRACE bp_write addr = 0007fd10
0.459243 TRACE backplane_writen addr = 0007fffc len = 4 val = ff4400bb
0.459344 DEBUG starting up core...
0.459395 TRACE backplane_readn addr = 18103800 len = 1
0.459614 TRACE backplane_readn addr = 18103800 len = 1 val = 0fea0001
0.459688 TRACE backplane_readn addr = 18103800 len = 1
0.459766 TRACE backplane_readn addr = 18103800 len = 1 val = 0fea0001
0.459837 TRACE backplane_writen addr = 18103408 len = 1 val = 00000003
0.459922 TRACE backplane_readn addr = 18103408 len = 1
0.459992 TRACE backplane_readn addr = 18103408 len = 1 val = 0fea0003
0.460053 TRACE backplane_writen addr = 18103800 len = 1 val = 00000000
0.461167 TRACE backplane_writen addr = 18103408 len = 1 val = 00000001
0.461257 TRACE backplane_readn addr = 18103408 len = 1
0.461331 TRACE backplane_readn addr = 18103408 len = 1 val = 0fea0001
0.462412 TRACE backplane_readn addr = 18103408 len = 1
0.462491 TRACE backplane_readn addr = 18103408 len = 1 val = 0fea0001
0.462557 TRACE backplane_readn addr = 18103800 len = 1
0.462630 TRACE backplane_readn addr = 18103800 len = 1 val = 0fea0000
0.462686 DEBUG wait for HT clock
0.480772 DEBUG setup interrupt mask
0.480797 TRACE backplane_writen addr = 18002024 len = 4 val = 000000f0
0.480896 DEBUG bluetooth setup interrupt mask
0.480919 TRACE backplane_writen addr = 18002024 len = 4 val = 00000020
0.481053 DEBUG waiting for F2 to be ready...
0.566231 DEBUG clear pad pulls
0.566343 DEBUG waiting for HT clock...
0.566406 DEBUG clock ok
0.566437 TRACE backplane_readn addr = 0006fffc len = 4
0.566585 TRACE backplane_readn addr = 0006fffc len = 4 val = 00017a7c
0.566640 DEBUG shared_addr 00017a7c
0.566692 TRACE bp_read addr = 00017a7c
0.567088 TRACE init_bluetooth
0.567115 TRACE backplane_writen addr = 19640894 len = 4 val = 00000003
0.569413 TRACE backplane_readn addr = 1921e040 len = 4
[...]

@rztz
Copy link
Author

rztz commented Dec 12, 2024

fixed: cyw43-pio/src/lib.rs clock divider has to increase for the different sys clock of rp2350 (tested just by doubling the divider)

@fatfingers23
Copy link

fatfingers23 commented Dec 27, 2024

Thanks for the tip on changing the divider! That got what I needed!

I do not have a Pico 2 W, but I do have Pimoroni's Pico Plus 2 W, and changing the clock divider to 0x0300 was what finally got it going for me! Later, I am going to check with the RM2 breakout module and see if that is the same reason.

Curious if that is the correct value the divider should be at and if it is worth a pr for a new feature flag like rm2 to use that divider for Pico Plus 2 w and other boards using the rm2?

RM2 link for context on it if needed.
https://shop.pimoroni.com/products/rm2-breakout?variant=53492995719547

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

2 participants