I2C on SC13048

Hi
I got my SC13048 board today. Flashed the latest Firmware.
Loaded the NuGet but get this error.

I have the GpIO and I2C NuGets.
Not sure what is wrong.
Without the I2C, the blinky works well

----Debug log—
Link failure: some assembly references cannot be resolved!!

Assembly: GHIElectronics.TinyCLR.Devices.I2c (2.1.0.0) needs assembly ‘GHIElectronics.TinyCLR.Devices.Gpio’ (2.1.0.0)

Error: a3000000

Waiting for debug commands…

the only thing I am sure of is you have a mismatch in your project between library versions and the version of firmware you have installed. Start a new project to make sure you’ve now got the correct/latest assemblies.

I would follow this step by step and only blink an led to start SITCore Start! – GHI Electronics

The blinky works fine.

As soon as I add the below as per your example, it fails

        var settings = new I2cConnectionSettings(0x40, 100_000); //The slave's address and the bus speed.
        var controller = I2cController.FromName(SC13048.I2cBus.I2c1);
        var device = controller.GetDevice(settings);-

We make new project, look good to us

We tested on firmware 6500. But if you have 6400 or 6300 it should be fine.

Start new project to see what happened. If new project work well then you may need clean nuget cache folder

One last note. I have seen cases where the device is confused!! Try erase all on TinyCLR config and then try again. Does this solve the issue?

If your project has package folder (VS2019), you need to delete them.
If your project doesn’t have package folder (VS2022), usually VS nuget cached here:

ok…Thanks the erase all worked

I get an exception now when device.Write(…)
is it because the device is not connected? or something else

#### Exception System.Exception - CLR_E_TIMEOUT (1) ####
#### Message: 
#### GHIElectronics.TinyCLR.Devices.I2c.Provider.I2cControllerApiWrapper::WriteRead [IP: 0000] ####
#### GHIElectronics.TinyCLR.Devices.I2c.I2cDevice::WriteRead [IP: 0027] ####
#### GHIElectronics.TinyCLR.Devices.I2c.I2cDevice::Write [IP: 000c] ####
#### Sample.Program::Main [IP: 00b1] ####

Exception thrown: ‘System.Exception’ in GHIElectronics.TinyCLR.Devices.I2c.dll
An unhandled exception of type ‘System.Exception’ occurred in GHIElectronics.TinyCLR.Devices.I2c.dll

This is mysterious issue that we are still trying to find!

The address is wrong. No pull up resistors. The device is not connected…

Everything working now, Thanks

1 Like