Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Cr1000 I2C SPI Communication 9DOF


Maloya Mar 10, 2015 01:31 PM

Hello Gents,
does cr1000 support i2C or SPI- Communication.
I´m in integrating a 9DOF- Sensor from Adafruit into the Cr1000.
Using a arduino as Interface i managed it. Now i would like to know if a direct communication is possible as well.
Does somebody in the forum know this?


GTProdMgr Mar 11, 2015 04:15 PM

We looked into this a few months ago when a customer wanted to integrate to a Honeywell sensor with I2C (i-squared-C).

The CR6 hardware is capable of doing this (both I2C and SPI) *if* the feature were implemented at the firmware/OS level. However that isn't on the current OS priority list. It may be 24 months or more before something like this gets onto the "implement" list.

I'm not certain whether the CR1000 hardware is capable of this
(once the OS work is done), but I don't think that it is. The same would go for the CR3000.

Any other users who have the need for reading I2C or SPI sensors/devices should comment on this thread so we can build up a list of customer needs/wishes.


pokeeffe Apr 16, 2015 10:28 PM

I recently bought the hardware to create a Bluetooth serial link between a CR1000 and Alicat mass flow controller. If the CR1K supported SPI, my hardware choices would have been broader.

I've had to walk away from I2C sensors before as well. :(

More generally, I think SPI and I2C make great sense for a datalogger. The uC arena is getting harder to distinguish from the dedicated datalogger arena (consider the CR6).


Maloya Apr 17, 2015 05:00 AM

Talking to the Campbell Representative of my Region, he told me It was possible using this:
http://www.nxp.com/products/interface_and_connectivity/bridges/i2c_spi_slave_to_uart_irda_gpio_bridges/series/SC16IS740_750_760.html

I haven't tried it out yet.


ZooKeeper Apr 17, 2015 04:11 PM

The CR1000 and CR3000 hardware does not support I2C and SPI like the CR6 so even after this is implemented in the OS it will be limited to the CR6.


SLMtech Sep 17, 2015 10:51 AM

I'd be interested too in a CR6 (or better: one of my CR1000's, but I understand that will not be possible) with SPI (or I2C) for Honeywell SSC series pressure sensors!

It's not completely clear to me: if I purchase a CR6 now, would that work with SPI (or I2C) communications?


aps Sep 17, 2015 11:40 AM

A quick answer is currently the CR6 does not support SPI or I2C, but it is something that is being added and should appear in the next release of operating system which will be a free download. I am not sure of the exact timescales for this, it may be a month or two off.

There is no work being done to support that protocols in the CR1000 (that I know of).


JDavis Sep 17, 2015 05:13 PM

You may purchase a I2C or SPI to RS232 interface. That is how customers have handled 1-wire as well.
Adapters like this are easy to connect to a CR1000.
http://www.coptonix.com/_en/html/rs232_i2c_adapter.html
http://www.i2cchip.com/#Host%20Adaptors

An interface will take care of the line clocking etc., but won't by itself give you understandable data values. You will have to deal with addressing, memory register numbers, and binary data types.

Using an adapter and a capable programmer, it can be done.


Phenomics Nov 19, 2015 09:31 PM

I would be interested in a datalogger that supports I2C. Mainly for Lidar-lite.


porlando Nov 9, 2017 08:49 PM

I am also interested in a datalogger that supports I2C and SPI. I am working with a state environmental agency that is interested in expanding their monitoring efforts through the use of low-cost sensors, many of which use serial protocols that are not currently supported by the CR1000. Including these protocols would allow us to greatly expand our sensor network!


DAM Nov 10, 2017 05:25 PM

The latest OS for the CR6 has support for I2C and SPI. Given the nature of both of these protocols and the variety of appications for them, the instructions are low level, and require understanding the device being communicated with and things such as bye ordering and byte manipulation to correctly perform the writes and reads. At this point, there are not "canned" up instructions to talk to any specific I2C or SPI devices, but someone experienced in communicating with these types of devices will be able to use the low level read and write instructions provided in CRBASIC to communicate with their chosen device.

Check out I2COpen, I2CRead, I2CWrite, SPIOpen, SPIRead, and SPIWrite instructions in the latest CRBASIC editor version.

The following CRBASIC example programs were used to configure and read an inclinometer that has both I2C and SPI interfaces:

I2C:

-------------------------------------------------------------------

Public Count as Long
Public id as long
Public tmp as Long
Public Dest(2) as Long
Public zero as Long
Dim pwr_ctrl as Long = {&H2D080000}
Dim bw_rate as Long = {&H2C060000}
Dim id_reg as Long = {&H80000000}
Dim Cfg as Long = {&H31000000}
Dim DReg as Long = {&HF2000000}
Public X as Long
Public Y as Long
Public Z as Long
BeginProg

PortPairConfig(C1,2) ' Set up C1,C2 as 3.3V
PortPairConfig(C3,2) ' Set up C3,C4 as 3.3V (for CS signal)
PortSet(C4,1,1) ' Drive the CS signal
I2COpen(C1,1000)
I2CWrite(C1,&H53,id_reg,1,&H2) ' Start with no stop
I2CRead(C1,&H53,tmp,2,&H5) ' restart with stop, read the id register
movebytes(id,3,tmp,0,1)

I2CWrite(C1,&H53,bw_rate,2,&H3) ' configure the bwrate register

I2CWrite(C1,&H53,pwr_ctrl,2,&H3) 'enable measurements

Scan(1,sec,0,0)
Count += 1
I2CWrite(C1,&H53,Dreg,1,&H2) ' send addr to read
I2CRead(C1,&H53,Dest,6,&H5) ' Read X,Y, and Z.
movebytes(X,2,Dest,0,2)
movebytes(Y,2,Dest,2,2)
movebytes(Z,2,Dest,4,2)
NextScan

--------------------------------------------

SPI:

---------------------------------------------

Public Count as Long
Public id as long
Public D as Long
Public Dest(2) as Long
Public zero as Long
Dim pwr_ctrl as Long = {&H2D080000}
Dim bw_rate as Long = {&H2C060000}
Dim id_reg as Long = {&H80000000}
Dim Cfg as Long = {&H31000000}
Dim DReg as Long = {&HF2000000}
Public X as Long
Public Y as Long
Public Z as Long
BeginProg

PortPairConfig(C1,2)
PortPairConfig(C3,2)
SPIOpen(C1,100000,&H60)

PortSet(C4,0,1) ' enable the CS
SPIWrite(C1,cfg,1) ' write the data format register address
SPIWrite(C1,zero,1) ' write the data format register with 0x0
PortSet(C4,1,1)

PortSet(C4,0,1) ' enable the CS
SPIWrite(C1,id_reg,1) ' write the id register address
SPIRead(C1,D,1) ' read the id register
PortSet(C4,1,1)
movebytes(id,3,d,0,1)

PortSet(C4,0,1) ' enable the CS
SPIWrite(C1,bw_rate,2) ' Write the bwrate register with &H06
PortSet(C4,1,1)

PortSet(C4,0,1) ' enable the CS
SPIWrite(C1,pwr_ctrl,2) ' write the pwr_ctrl register with &H08
PortSet(C4,1,1)

Scan(1,sec,0,0)
Count += 1
PortSet(C4,0,1)
SPIWrite(C1,Dreg,1) ' send addr to read
SPIRead(C1,Dest,6) ' Read X, Y, and Z.
PortSet(C4,1,1)
movebytes(X,2,Dest,0,2) ' Move X into its own variable
movebytes(Y,2,Dest,2,2) ' Move Y into its own variable
movebytes(Z,2,Dest,4,2) ' Move Z into its own variable
NextScan

---------------------------------------------------------


Jcale08 Aug 27, 2018 03:37 PM

" I'm not certain whether the CR1000 hardware is capable of this
(once the OS work is done), but I don't think that it is. The same would go for the CR3000. "

GTProdMgrMar 11, 2015 12:15 PM

Is integration with i2c possible yet? If so, can you provide instruction on how to achieve? 

Thanks, 

John 


JDavis Aug 27, 2018 05:00 PM

I2C and SPI are only being supported on dataloggers that have coprocessors dedicated to channel pairs. The only dataloggers with that capability are the CR6 and the CR1000X.

Log in or register to post/reply in the forum.