A C++ class that uses libusb to interface with MCP2210 devices. It can be used to control the several aspects, such as NVRAM or volatile configurations, GPIO directions and states, or to perform SPI transfers. Note that this is a class variant made specifically for Qt. If you wish to use the original, non-Qt variant, please refer to https://github.com/bloguetronica/mcp2210.
0
stars
0
forks
source link
Function writeUSBParameters() sets power mode bits incorrectly #9
This is in line with the issue reported here. Currently, writeUSBParameters() is implemented as follows:
// Writes the USB parameters to the MCP2210 OTP NVRAM
quint8 MCP2210::writeUSBParameters(const USBParameters ¶meters, int &errcnt, QString &errstr)
{
QVector<quint8> command{
SET_NVRAM_SETTINGS, USB_PARAMETERS, 0x00, 0x00, // Header
static_cast<quint8>(parameters.vid), static_cast<quint8>(parameters.vid >> 8), // Vendor ID
static_cast<quint8>(parameters.pid), static_cast<quint8>(parameters.pid >> 8), // Product ID
static_cast<quint8>(parameters.powmode << 7 | !parameters.powmode << 6 | parameters.rmwakeup << 5), // Chip power options
parameters.maxpow // Maximum consumption current
};
QVector<quint8> response = hidTransfer(command, errcnt, errstr);
return response[1];
}
However, given that when parameters.powmode is true it means that the device is self powered, then the 8th line, which corresponds to line 850 (located inside mcp2210.cpp) must be changed to:
This is in line with the issue reported here. Currently, writeUSBParameters() is implemented as follows:
However, given that when parameters.powmode is true it means that the device is self powered, then the 8th line, which corresponds to line 850 (located inside mcp2210.cpp) must be changed to:
static_cast<quint8>(!parameters.powmode << 7 | parameters.powmode << 6 | parameters.rmwakeup << 5), // Chip power options