From nobody Sat Nov 16 01:27:02 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xqx882cRGz5cb7D for ; Sat, 16 Nov 2024 01:27:20 +0000 (UTC) (envelope-from tomek@cedro.info) Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xqx870gF5z4DqJ for ; Sat, 16 Nov 2024 01:27:19 +0000 (UTC) (envelope-from tomek@cedro.info) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cedro.info header.s=google header.b=dSypWL6T; spf=none (mx1.freebsd.org: domain of tomek@cedro.info has no SPF policy when checking 2607:f8b0:4864:20::1136) smtp.mailfrom=tomek@cedro.info; dmarc=none Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-6ee676b4e20so9864057b3.3 for ; Fri, 15 Nov 2024 17:27:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cedro.info; s=google; t=1731720438; x=1732325238; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=s1PIa3X71/UQww5k+kBiGXxIRkoGWyOQZtJ8J9dvzpA=; b=dSypWL6T6kfzIHNAF/X/XYv/oISrcvYVLvGbg+29N8OfPW939t3OScFT7fH/n4az1T ug1+YbEbUKzAVuUQh5JeVgGOUl907KOtPRBspmQPFJhydjmq8tGt0XmtKLMfxHqiWCjW wkY4mBsydaZ3njl8QDOzuYwtyEepqXOW4yXlu0DxuJ7wKxdZcfms9TXgQS4Esqx9Jnil 9Dc9LYzqnioeT53Vk0JeUzdh1UMLx6mqhKsbnVsqIEFIU6PCsPTmPVcI9xy2HXZ4B/gw tP4z4piqEGHyhkhSzgP9sukzoT5AeA7rifRyVQjhEOBShC8YFrYwdT5jaxOgsIo/A2O0 AISw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731720438; x=1732325238; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s1PIa3X71/UQww5k+kBiGXxIRkoGWyOQZtJ8J9dvzpA=; b=ubwGwYSIBzY5XIsGJvaY8tD6aQNHHfdfYLpbdQuP4A9f4Sq68dgDsuJfWsQ3ZQkhLo olJQFiWbDn82RNm9dJzJABPQul9tfUPq+gFwV0Ctvy62WiQRsl3C5ynOApehhDA32ZtD TeVOmKEdEgrUl0+pXppGVwLCVkR0eNi835WkVoc838yX/1Ehjxpmh9g22tPcuWHkdQWK 60+DLc8er1uHTwalZPpNRSoCtZITYCo8DzJJZCtPstnuPj7/b4JgKmimUkCePS3+WxMW kFzBF9Rcg5Ff5Yg9lj7Wn05dBEYiOBW/+9haJmv3ks0i+3x7ZlBlXVQGQ8BS3/fLGsL5 pdrw== X-Gm-Message-State: AOJu0Yzc6Wok9Y84NpdZaCDIuiD+B+0NTBEIQLq+ECyHxNY2yNGvcApO EXJ5yE6J3fI9e7/EpsUACyBof8pIVTdX8e0IjdMH4L3rG2G367Lc2uCMVgt8pnf/ijPOcehU0XI = X-Google-Smtp-Source: AGHT+IGnpeZojbly4xqzaNeoOAE/uEOWg6JPz7LvW0CHO8Qne8b9lF6/HLEQn25nWV88L+ODmHdfiQ== X-Received: by 2002:a05:690c:d19:b0:6ea:85ee:b5e3 with SMTP id 00721157ae682-6ee55bb9c58mr54534867b3.5.1731720437682; Fri, 15 Nov 2024 17:27:17 -0800 (PST) Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com. [209.85.219.173]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6ee712c568esm1397217b3.59.2024.11.15.17.27.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Nov 2024 17:27:16 -0800 (PST) Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-e382350652bso1401694276.3 for ; Fri, 15 Nov 2024 17:27:15 -0800 (PST) X-Received: by 2002:a05:690c:6707:b0:6de:a3:a7ca with SMTP id 00721157ae682-6ee55cbc10cmr62141177b3.32.1731720434832; Fri, 15 Nov 2024 17:27:14 -0800 (PST) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 References: <21c28238-99d6-4452-8073-a34009503d67@m5p.com> <7b8f93f6-0611-41a7-bea2-23190da9be78@m5p.com> In-Reply-To: From: Tomek CEDRO Date: Sat, 16 Nov 2024 02:27:02 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Simpler Question (Re: MCP2221 I2C/UART to USB) To: George Mitchell Cc: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.30 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.997]; R_DKIM_ALLOW(-0.20)[cedro.info:s=google]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MISSING_XM_UA(0.00)[]; TAGGED_RCPT(0.00)[freebsd]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; R_SPF_NA(0.00)[no SPF record]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::1136:from,209.85.219.173:received]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[cedro.info]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; RCVD_TLS_LAST(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; DKIM_TRACE(0.00)[cedro.info:+] X-Rspamd-Queue-Id: 4Xqx870gF5z4DqJ X-Spamd-Bar: --- On Thu, Nov 14, 2024 at 12:21=E2=80=AFAM Tomek CEDRO wro= te: > On Thu, Nov 14, 2024 at 12:08=E2=80=AFAM George Mitchell 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: at usbus0 Nov 16 02:08:30 octagon kernel: umodem0 on uhub21 Nov 16 02:08:30 octagon kernel: umodem0: 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: on usbus0 Nov 16 02:08:30 octagon kernel: hidbus5: 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 =3D 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 :-) --=20 CeDeROM, SQ7MHZ, http://www.tomek.cedro.info