Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Using I2C API with cRIO-9048

Hello,

 

I have a cRIO-9048 and an NI-9402 module. I'd like to use the SPI and I2C Driver API to communicate I2C between the NI-9402 module and an external chip. I installed the package and am trying to compile the example code but the compiler is throwing the following code generation errors:

 

Clock domain crossing is not selected for the memory item.

- Memory Read 'Memory Method Node'

- Memory Write 'Memory Method Node'

 

Details:

The memory Read and Write interfaces are located in different clock domains and the Dual Clock Interface option is not selected. Either place both interfaces in the same clock domain or place a checkmark in the Dual Clock Interface checkbox in the Memory Properties dialog box.

 

I found where the memory item is initialized in Initialize Port (I2C).vi, but when I open up the properties for the memory item the "Dual Clock Interface" checkbox is grayed out (this is after I figured out I have to hit Ctrl-M to actually be able to edit the VI). I can activate it by changing the implementation to Block Memory instead of Lookup Table, but doing that breaks the VI and I'm not sure how to fix it. Something about disagreeing data types...

 

The other suggestion in the details is to match the clock domains of the reading and writing nodes. I'm not really sure how to do that either. I don't fully understand the structure of this demo application, I just want to write some I2C... It's also not obvious to me how to make my own implementation that would be any simpler than this example one.

 

Any ideas? It seems the example project is set up for an sbRIO-9631. Is there something special about that device that my cRIO-9048 doesn't have? Some hidden setting somewhere that I'm supposed to know about? In my previous thread on this topic I was lead to believe that everything would work smoothly if I bought a NI-9402 module, but so far that has not been the case.

 

Thanks,

Mitcham

 

 

0 Kudos
Message 1 of 2
(1,176 Views)

Update:

 

I can make the code compile successfully if I change the SCTL in IP Port (I2C).vi to be a normal while loop. Still no actual data outputs, but at least it runs. I don't know what other consequences it might have.

 

Looking inside I2C Write.vi, I noticed that in several of the cases the pink I/O item blocks are "Set Output Enable" methods when it seems like they should be "Set Output Data" methods. For example, in the case "Set SDA with Data" there is a comment "Place bit on data line" next to some blocks that sure look like they are supposed to be formatting the data to be written and feeding it to an I/O block to be output. However, the I/O block is a "Set Output Enable" type. Is that a mistake or am I missing something? I've tried changing a few of these and it does compile, but I haven't yet gotten a data or clock output.

 

Thanks,

Mitcham

0 Kudos
Message 2 of 2
(1,113 Views)