MCP2221A-How is the UART baud rate changed?[SOLVED] - Page 1
Forum section: electronics / projects

author: djsb
author_rank: Super Contributor
timestamp: February 01, 2021, 06:24:04 pm
content: I've just started experimenting with a MCP2221A USB to i2c bridge module (Adafruit). I've tried using MCP2221CLI.exe, and it works well.Not only that, but I've connected a PIC MCU which sends and receives serial data to the TX and RX pins of the MCP2221A. I'm trying to fine tune the communication as putty receives messages FROM the PIC ok but it doesn't work properly in the other direction. I have firmware in the PIC that echo's anything I type on the PC keyboard. This works fine with a conventional RS232 interface but not with the MCP2221A interface.What I'd like to know is how can I change the baud rate of the UART contained in the MCP2221A? The utility/configuration application and command line interface do not allow the baud rate to be changed. The data sheet mentions a command but does not go into detail about how to use this command.QuoteCan anyone shed any light on how the baud rate can be changed? Thanks.PSHere is a link to the data sheet.http://ww1.microchip.com/downloads/en/devicedoc/20005565b.pdf

author: fourtytwo42
author_rank: Super Contributor
timestamp: February 01, 2021, 07:12:18 pm
content: Funny I was looking at that chip today, haven't got one though!I assume your taking about a windows host, surely the device driver is supposed to support the chip such that when you change the bit rate configuration in your favourite terminal program (e.g. putty) the device driver goes ahead and does it ?Or are you asking what the programmatic interface through the dreaded win api is supposed to be ?

author: Buriedcode
author_rank: Super Contributor
timestamp: February 01, 2021, 07:34:57 pm
content: The host/PC software/terminal determines the baud.What terminal program are you using?

author: djsb
author_rank: Super Contributor
timestamp: February 01, 2021, 09:08:51 pm
content: Thanks for your replies.Yes I'm using Windows 10 and putty. Can try a few different terminal programs no problem. I didn't install a driver so assumed Windows was handling the USB side of things. I think the MCP2221Utilty application installed a driver but not sure. I'll try changing the baud rate on the PIC (and terminal) that's sending the data and see if things improve. I wonder if changing the clock speed of the PIC from 8MHz to 12MHz (same clock speed as the MCP2221A) will make a difference? I'll try that as well.

author: jc101
author_rank: Frequent Contributor
timestamp: February 01, 2021, 10:22:11 pm
content: The PIC UART and the PC terminal software baud rate need to match. Just set the baud rate in Putty and ensure flow control etc. is off.I use the MCP2221A with PIC18 and PIC32 without a problem, it's plug and play on the Windows side with no drivers required. Might be worth checking with a scope you see the data from the PC on the PIC RX line is what you expect it to be.

author: djsb
author_rank: Super Contributor
timestamp: February 02, 2021, 01:39:34 pm
content: The PIC I'm using to send and receive the serial data is using software serial as the PIC16F819 doesn't have a USART. This probably means that the timing is a bit off. I'll try it with a pic16f1847 which has an EUSART. Thanks everyone for your help.