Closed evilmav closed 2 years ago
Yes, this is correct. You need to set the cs pin up using set_gpio_designation
This seems confusing: the way I read the docs I have expected to set all my GP0-GP8 to CHIP_SELECT and then choose which one of the slaves the current transmission goes to with cs_pin_number...
You make a good point; I had originally only ever used this device with a single slave. Unfortunately I don't have access to this device anymore, but if you'd like to fix and add a pull request I'd be happy to merge it. In the meantime, I suppose you could just set all pins to low GPIO except the CS pin for the slave you are interested in communicating with.
OK, the good news is that it only takes a trivial modification of the commented lines to make it actually work. We send SPI config each time anyway, so why not. It also takes a change of the masks to 0x1FF rather then 0xFF due to GP8. The bad is that GP8 seems to still be broken and likely actually due to hardware errata. It goes high impedance during unrelated transfers for me and I can't get it to make a proper CS pulse. I'll see if I can find a workaround, they seem to have something in their DLL, or see if I can make it work with a pullup resistor. For anyone reading this in the future: avoid GP8 as CS.
I'll send a pull request once I've figured that out or went mad trying.
@CarlosDerSeher, are you the one from https://www.microchip.com/forums/m734168.aspx? If so, have you figured that out?
Hmmm this was such a long time ago... The project using this chip died anyway, for different reasons though. I can't tell if I got feedback from microchip back then, but as I used GP8 as shutdown pin (active low) for an audio amplifier I think I ended up never pulling that pin low and leaving the amplifier turned on all times which wasn't much of a problem because the device was connected to AC mains and GP8 had an external pull up resistor.
Sorry I can't be of much help here.
Thank you @CarlosDerSeher for taking your time to reply! I've opened a ticket and microchip's answer was only "use another pin" so far. Not sure it's going anywhere, so I'm creating a pull request for this feature and a separate issue #5 for the GP8 topic.
I have just deployed version 1.0.4 to pypi, so you should be able to pip install the new version now.
The only relevant reference to
cs_pin_number
inspi_exchange
seems to be commented out in https://github.com/jeremyherbert/mcp2210-python/blob/75e3c357eae1ed212606a85f4632fd49b6586371/mcp2210/mcp2210.py#L678 .