openMLA / elegoo-mars-4-dlp-controller

Raspberry pi hat for the elegoo mars 4 dlp UV projector. Implements SPI data transfer for the DLPC1438.
Other
2 stars 0 forks source link

Error while reading i2c port 1 #6

Closed Hackerman2016 closed 2 months ago

Hackerman2016 commented 3 months ago

Hello,

I am trying to run the python script and I am getting an error where the i2c 1 port is undetectable. I have tried adding these lines in the boot file 'dtparam=i2c_arm=on dtparam=i2c1=on'

Still I get the same error. Here is the error that I get:

File "/home/pi/Desktop/UV_projector/controller.py", line 61, in init i2c_bus.read_byte(self.addr) # check if i2c is already active. Then we are in [2] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 5] Input/output error

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/Desktop/main.py", line 24, in DMD = DLPC1438(i2c, spi) ^^^^^^^^^^^^^^^^^^ File "/home/pi/Desktop/UV_projector/controller.py", line 85, in init while i2c_bus.read_byte(self.addr) == 0:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 5] Input/output error

NemoAndrea commented 3 months ago

hmm, what does i2cdetect -y 1 give?

Hackerman2016 commented 3 months ago

It gives a table where there are no addresses assigned. So it is just a table with dashes.

NemoAndrea commented 3 months ago

Okay, so that means that the I2C hardware on the Pi is working. I don't really know what is causing the issue; it certainly seems like the DLPC1438 is not starting properly. Do you see some LEDs lit up on the mainboard? Does it work if you run the code a few times (Sometimes it needs one run to get going; something not quite right about the power up cycle in the code)

Hackerman2016 commented 3 months ago

I did running the code 3-4 times, still same error. That is what I am wondering, that i2cdetect -y 2 shows address and -y 1 doesn't. Does that mean one of the ports is working and one isn't? (1 of the 2 picoclasps that we connect on the pcb). I have tried running test scripts for the 2nd port and they work correctly so I think there has to be maybe an issue on the hardware soldering side or in the connections on the pcb.

Also yeah LEDs on the DLPC1438 do light up for a while and then after I get the error they turn off.

Hackerman2016 commented 3 months ago

image0 (2)

Do i need to solder these adapters too on the pcb or are they optional? What are their functions?

Also does any pin or cable go into the adapter labelled i2c, cause I can't seem to find any that go in that.

NemoAndrea commented 2 months ago

image0 (2)

Do i need to solder these adapters too on the pcb or are they optional? What are their functions?

Also does any pin or cable go into the adapter labelled i2c, cause I can't seem to find any that go in that.

Those circled solder points are indeed optional :). They can be used if you find you need those pins for something else (e.g. you want to connect to another SPI peripheral or need some 3.3V power for something).

The I2C connector on the right side in your image is also there just as an optional extra; if you want to connect one of the many i2c breakout boards that use a StemmaQT/QWIIC connector. But it is not needed for operation of the DMD unit.

NemoAndrea commented 2 months ago

I did running the code 3-4 times, still same error. That is what I am wondering, that i2cdetect -y 2 shows address and -y 1 doesn't. Does that mean one of the ports is working and one isn't? (1 of the 2 picoclasps that we connect on the pcb). I have tried running test scripts for the 2nd port and they work correctly so I think there has to be maybe an issue on the hardware soldering side or in the connections on the pcb.

Also yeah LEDs on the DLPC1438 do light up for a while and then after I get the error they turn off.

Hmm this is interesting, I will check if maybe I use i2c bus 2 and forgot to add that to documentation.

Okay, the LED on the DLPC1438 board turning off means that at least one of the hardware connections from the picoclasp is working OK).

NemoAndrea commented 2 months ago

I did running the code 3-4 times, still same error. That is what I am wondering, that i2cdetect -y 2 shows address and -y 1 doesn't. Does that mean one of the ports is working and one isn't? (1 of the 2 picoclasps that we connect on the pcb). I have tried running test scripts for the 2nd port and they work correctly so I think there has to be maybe an issue on the hardware soldering side or in the connections on the pcb.

From what I gather, /dev/i2c/2 is the i2c data for the HDMI connector, and is therefore not showing the board data. /dev/i2c/1 (what you see by i2cdetect -y 1) should be i2c bus that you need. That one is also the one the code uses.

So it seems that for whatever reason the elegoo board is not showing up on the i2c bus. That could be for various reasons: the i2c connection having issues, the elegoo board not starting due to faulty connections, the elegoo board not starting because it is damaged etc. It is a bit surprising since the board is responding to the code - so maybe that points to the i2c connection soldering being off?

Hard to say without really probing the board itself I think. You could doublecheck the solder connections and see if there is anything wrong.

Hackerman2016 commented 2 months ago

Yes indeed, there was a problem with one of pins when I soldered them, fixing that resolved the issue, thanks.