Re: Simpler Question (Re: MCP2221 I2C/UART to USB)
Date: Sat, 16 Nov 2024 01:27:02 UTC
On Thu, Nov 14, 2024 at 12:21 AM Tomek CEDRO <tomek@cedro.info> wrote: > On Thu, Nov 14, 2024 at 12:08 AM George Mitchell <george+freebsd@m5p.com> wrote: > > > Okay I just ordered the MCP2221A Breakout Stemma QT/Qwiic for ~10EUR > > > it should arrive on Friday/Monday will see what happens ;-) > > That just happens to be the board I was hoping to get! -- George > Cool I will let you know how it works :-) This MCP2221A works like a charm out of the box on FreeBSD 13.3 :-) Nov 16 02:08:30 octagon kernel: ugen0.6: <Microchip Technology Inc. MCP2221 USB-I2C/UART Combo> at usbus0 Nov 16 02:08:30 octagon kernel: umodem0 on uhub21 Nov 16 02:08:30 octagon kernel: umodem0: <Microchip Technology Inc. MCP2221 USB-I2C/UART Combo, class 239/2, rev 2.00/1.00, addr 5> on usbus0 Nov 16 02:08:30 octagon kernel: umodem0: data interface 1, has no CM over data, has no break Nov 16 02:08:30 octagon kernel: usbhid5 on uhub21 Nov 16 02:08:30 octagon kernel: usbhid5: <Microchip Technology Inc. MCP2221 USB-I2C/UART Combo, class 239/2, rev 2.00/1.00, addr 5> on usbus0 Nov 16 02:08:30 octagon kernel: hidbus5: <HID bus> on usbhid5 Then /dev/cuaU0 shows up and I can connect to some board over UART: nsh> uname -a NuttX 12.7.0 5d8cdeaea8-dirty Nov 16 2024 02:02:28 arm nucleo-f4x1re I used minicom to change baud and it seems to work. Note this chip does not have control lines so you probably need to use GPIO to reset / select boot if necessary. Regarding the additional stuff it seems to work in Python over hid but I did not play any further (after cable disconnect I got errors on commands so there is some communication). (venv3.11embedded) python Python 3.11.10 (main, Sep 14 2024, 01:19:37) [Clang 17.0.6 (https://github.com/llvm/llvm-project.git llvmorg-17.0.6-0-g600970 on freebsd13 Type "help", "copyright", "credits" or "license" for more information. >>> from PyMCP2221A import PyMCP2221A >>> mcp2221 = PyMCP2221A.PyMCP2221A() >>> mcp2221.GPIO_Init() mcp2221.ADC_1_Init() mcp2221.CLKDIV_2 mcp2221.CLKDUTY_25 mcp2221.DAC_2_Init() mcp2221.GPIO_0_InputMode() mcp2221.GPIO_1_Input() mcp2221.GPIO_2_DIR mcp2221.GPIO_3_BIT mcp2221.GPIO_3_OutputMode() mcp2221.I2C_Read( mcp2221.Read_Flash_Data( mcp2221.ADC_2_Init() mcp2221.CLKDIV_32 mcp2221.CLKDUTY_50 mcp2221.DAC_Datawrite( mcp2221.GPIO_0_MODE mcp2221.GPIO_1_InputMode() mcp2221.GPIO_2_Input() mcp2221.GPIO_3_DIR mcp2221.GPIO_Init() mcp2221.I2C_Read_Repeated( mcp2221.Reset() mcp2221.ADC_3_Init() mcp2221.CLKDIV_4 mcp2221.CLKDUTY_75 mcp2221.DeviceDriverInfo() mcp2221.GPIO_0_Output( mcp2221.GPIO_1_MODE mcp2221.GPIO_2_InputMode() mcp2221.GPIO_3_Input() mcp2221.GPIO_Read() mcp2221.I2C_State_Check() mcp2221.Write_Flash_Data( mcp2221.ADC_DataRead() mcp2221.CLKDIV_64 mcp2221.ClockOut( mcp2221.GPIO_0_BIT mcp2221.GPIO_0_OutputMode() mcp2221.GPIO_1_Output( mcp2221.GPIO_2_MODE mcp2221.GPIO_3_InputMode() mcp2221.GPIO_Write() mcp2221.I2C_Write( mcp2221.mcp2221a mcp2221.CLKDIV_128 mcp2221.CLKDIV_8 mcp2221.Command_Structure( mcp2221.GPIO_0_DIR mcp2221.GPIO_1_BIT mcp2221.GPIO_1_OutputMode() mcp2221.GPIO_2_Output( mcp2221.GPIO_3_MODE mcp2221.I2C_Cancel() mcp2221.I2C_Write_No_Stop( mcp2221.CLKDIV_16 mcp2221.CLKDUTY_0 mcp2221.DAC_1_Init() mcp2221.GPIO_0_Input() mcp2221.GPIO_1_DIR mcp2221.GPIO_2_BIT mcp2221.GPIO_2_OutputMode() mcp2221.GPIO_3_Output( mcp2221.I2C_Init( mcp2221.I2C_Write_Repeated( Regarding the rPI Zero 2W I dd'ed the 14.1 SD image for RPI and got the rainbow box on hdmi but some updates are needed in the firmware files on first partition, I quickly updated to git master but that did not help, and I not rally have time now to play, but it was fun to try :-) Have fun George :-) -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info