I2C and SPI on the P2
iseries
Posts: 1,492
I have several devices that do not work on the P2 that work just fine on the P1.
For example the DS1302 works fine on the P1 and not on the P2.
I have the BME680 that works fine on the P1 and not on the P2.
The problem is that these devices were not designed to work at the P2 speeds and the drivers were not designed to allow for them. Face it the P1could not go fast enough.
I think now we need new drivers that address the speed issue.
The I2C spec shows there are 4 different clock speed available, 100kb/s, 400kb/s, 1mb/s, and 3.4mb/s. SPI does not show a speed but there are limits.
So we need drivers that will allow for different speeds as an input option. In the case of SPI maybe a divider value to allow for lower clock speeds.
Mike
For example the DS1302 works fine on the P1 and not on the P2.
I have the BME680 that works fine on the P1 and not on the P2.
The problem is that these devices were not designed to work at the P2 speeds and the drivers were not designed to allow for them. Face it the P1could not go fast enough.
I think now we need new drivers that address the speed issue.
The I2C spec shows there are 4 different clock speed available, 100kb/s, 400kb/s, 1mb/s, and 3.4mb/s. SPI does not show a speed but there are limits.
So we need drivers that will allow for different speeds as an input option. In the case of SPI maybe a divider value to allow for lower clock speeds.
Mike
Comments
There are already drivers for such protocols in the Github-Obex, mainly made by JonnyMac:
https://github.com/parallaxinc/propeller/tree/master/libraries/community/p2/Protocol
As you see they let you define the clock speed as a parameter of the start methode.
I've noticed too much of this "porting" from P1 to P2 but the P2 does things differently. We never had the problem with the P1 because we just wrote software to suit the P1. None of this porting nonsense. Same goes for the P2.
EDIT: just checked the DS1302 datasheet and boy is it a slow device for the SPI bus. It specifies 2MHZ max on the SPI bus. You can bit-bash in Spin and you might still have to add a delay.
My I2C drivers can be set to different bus speeds to suit and I scan at 100kHz to catch any slow old devices, work with most at 400kHz, and talk to my UB3 micro at up to 3MHz or more.
Here's part of my boot report that scans the hardware.
dgately