Page 1 of 1
LCD + AMP skins incompatibility?
Posted: Sat Nov 08, 2014 11:06 pm
by MicroNewbie
Hi,
I would appreciate it if somebody tried this code having both the LCD(+ touch interface) and the AMP skins mounted on his/her board:
Code: Select all
import pyb
# starting the LCD
lcd = pyb.LCD('Y')
# defining a function to set the AMP volume
def setvolume(value):
pyb.I2C(1, pyb.I2C.MASTER).mem_write(value, 46, 0)
# calling the function
setvolume(50)
For some reason, the following error is raised in my board:
Code: Select all
Exception: HAL_I2C_Mem_Write failed with code 2
It only happens in this type of situations (anytime I try to set the AMP's volume after having started the LCD)
Could this be happening due to misassembling (eg bad soldering)?
Thank you guys, I'm new in this forum and I look forward to sticking around here for quite some time

Re: LCD + AMP skins incompatibility?
Posted: Mon Nov 10, 2014 3:17 pm
by blmorris
I don't have the LCD or AMP skins to replicate your setup so I can't test this directly. However, I believe that the error that you report is the same one I had seen a while back, can't dig it up now but it was a timing issue, trying to execute a command on the I2C bus before it was fully initialized.
I suspect that the problem is that you are repeatedly initializing the I2C bus every time you execute a memory write, which shouldn't fail, but it does cause the I2C bus to unnecessarily repeat its initialization procedure:
Code: Select all
pyb.I2C(1, pyb.I2C.MASTER).mem_write(value, 46, 0)
This code only initializes the I2C bus once:
Code: Select all
import pyb
# starting the LCD
lcd = pyb.LCD('Y')
i2c = pyb.I2C(1, pyb.I2C.MASTER)
# defining a function to set the AMP volume
def setvolume(value):
i2c.mem_write(value, 46, 0)
# calling the function
setvolume(50)
BTW, it is strange that your post took a day and a half to show up on the forum...
-Bryan
Re: LCD + AMP skins incompatibility?
Posted: Mon Nov 10, 2014 3:35 pm
by dhylands
I have both.
I tried your code and it worked for me (although I have recent firmware).
What version of firmware are you running?
I attached a photo of what my pyboard looks like with both shields mounted. The mounting holes between the shield and the pyboard should line up.
Are you saying that your code doesn't fail if you remove the lcd code?

- IMG_20141110_072737.jpg (319.17 KiB) Viewed 5110 times
Re: LCD + AMP skins incompatibility?
Posted: Mon Nov 10, 2014 10:59 pm
by MicroNewbie
Hi again,
Thank you very much for the responses.
I'm currently abroad due to work, but I will try both the provided code fix and the firmware update when I get back home. The connections between the skins and the board looked correctly (the pins match OK, but I don't trust my soldering skills at all).
Also, I believe my board is running version 1.3.3, but I can't check it right now and I might be wrong.
Are you saying that your code doesn't fail if you remove the lcd code?
Exactly

Re: LCD + AMP skins incompatibility?
Posted: Tue Nov 11, 2014 10:04 pm
by MicroNewbie
Hi,
Today I updated the firmware to the build created today (pybv10-2014-11-11-v1.3.6-12-gb98c162.dfu).
Now, instead of raising an error in the python shell, the board itself registers an error (the 4 onboard LEDs cycle on and off slowly) and I have to reset it.
But also, I tried my skins on a friend's pyboard, and the code runs just ok. So the cause might be:
- A) There's a problem with my board.
B) I solder really bad.
I'll try re-soldering and seeing whether the error disapears or not
Thank you both for your responses
