micropython-raspberrypi icon indicating copy to clipboard operation
micropython-raspberrypi copied to clipboard

USB/SPI/I2C device mode, does it work?

Open mfp20 opened this issue 4 years ago • 9 comments

Regards

mfp20 avatar Feb 24 '21 13:02 mfp20

Sorry, not implemented.

boochow avatar Feb 24 '21 14:02 boochow

Is it hard to implement?

mfp20 avatar Feb 24 '21 14:02 mfp20

I believe it is hard, because I haven't seen any bare-metal project which supports USB device mode

boochow avatar Feb 24 '21 14:02 boochow

I see, I can't find any. Thanks!

BTW, what is the pin toggle speed?

mfp20 avatar Feb 24 '21 14:02 mfp20

Sorry, I haven't measure it.

boochow avatar Feb 24 '21 14:02 boochow

What about SPI and I2C? Do they work in slave mode?

mfp20 avatar Feb 24 '21 15:02 mfp20

I have only tested master mode for both SPI and I2C. RPi's hardware SPI does not support slave mode anyway.

boochow avatar Feb 24 '21 15:02 boochow

I have only tested master mode for both SPI and I2C. RPi's hardware SPI does not support slave mode anyway.

https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf

Page 4

SPI Slave is supported by hardware, but linux support has been added around v4.13. I wouldn't be surprised if nobody ever used it yet. It looks like the protocol isn't strict enough, so plenty incompatible implementations exist.

mfp20 avatar Feb 24 '21 17:02 mfp20

SPI Slave is supported by hardware, but linux support has been added around v4.13.

maybe it is referring BSC/SPI described in chapter 11, which I have not implemented. I only implemented SPI0, which cannot be used in slave mode. Also, I have read at somewhere that BSC/SPI slave does not work correctly

boochow avatar Feb 25 '21 16:02 boochow