12 de abril de 2021

Do bit Ao Byte

Embarcados, Linux e programação

Uno32 Chipkit no VS Code

Uno32 Chipkit no VS Code

Apesar do falso cognato e verossimilhança, essa placa não é um Arduino. Apesar de parecer algo novo, também não é; aliás, é uma placa “antiga” e descontinuada, da qual escrevi a respeito há muito tempo. Então, por qual razão escrever novamente sobre essa placa? Bem, se você encontrar para comprar, compre. E explico o porque, mostrando a Uno32 chipkit no VS Code.

Características da placa

Na época havia duas IDEs que a suportavam, mas já adianto: Não usaria a MPlab; no máximo, a MPIDE. O MPlab é horrível, pesado, feio, o compilador free é limitado, tudo é instalado à parte, mexe em configurações do sistema (como regras do udev), etc. Mas, caríssimo leitor, hoje essa placa está no PlatformIO, linda e fácil de usar, bastando criar um novo projeto com ela usando o framework do Arduino!

Como os links originais não estão mais disponíveis, e provavelmente essas informações se perderão em breve, vou registrá-las aqui para perpetuá-las.

Processador

Não é uma microcontroladora de 8bits; supreenda-se! Temos aqui um PIC32MX320F128H com as seguintes características:

  • 80MHz
  • 32bits
  • MIPS M4K
  • Montes de interrupções
  • 128KB de memória de programa
  • 32KB de SRAM
  • 2 SPI
  • 2 I2C
  • 16 ADC de 10 bits com 1 Mega de amostragens por segundo
  • Até 53 pinos de I/O
  • 64 pinos

Características da placa

  • Compatível com códigos do Arduino
  • Formato do Arduino UNO
  • Compatível com shields Arduino
  • Nível lógico 3v3
  • 42 GPIO disponíveis
  • 2 LEDs de uso geral
  • Conexão mini-USB
  • 75mA de consumo
  • Tensão de entrada de 7V à 15V, marcada na placa
  • 18mA por pino

Pinout

Peguei a placa no manual de referência, que encontrei em outro link. A disposição é essa:

Uno32 Chipkit no VS Code

  • 1 – Conector USB para programação e alimentação
  • 2 – Conector do debugger
  • 3 – Alimentação externa
  • 4 – Regulador 3v3
  • 5 – Bypass do regulador de tensão para alimentação externa
  • 6 – regulador 5V
  • 7 – alimentação para shields
  • 8 – MCU
  • 9 – ADC
  • 10 – muda entre ADC e I2C nos pinos 9 e 11 ou A4 e A5, para SDA e SCL, respectivamente
  • 11 – SPI
  • 12 – Seletor de SPI master/slave
  • 13 – LEDs do usuário, nos pinos 13 e 43
  • 14 – GPIO digital
  • 15 – Jumper para trocar o pino 5 (D10) de PWM para SPI.
  • 16 –  Conector digital
  • 17 – I2C
  • 18 – LEDs de comunicação
  • 19 – Reset

Faltaram detalhes, mas não vou traduzir tudo porque tenho preguiça. Opcionalmente deixo o texto original:

1. USB Connector for USB Serial Converter
This connects to a USB port on the PC to provide the communications port for the MPIDE to talk to
the Uno32 board. This can also be used to power the Uno32 board when connected to the PC.

2. JP3 – Microchip Debug Tool Connector
This connector is used to connect Microchip programmer/debugger tools, such as the PICkit™3. This
allows the Uno32 board to be used as a traditional microcontroller development board using the 
Microchip MPLAB® IDE.

3. J4 – External Power Connector
This is a 5.5mm x 2.1mm barrel connector used to power the Uno32 board from an external power supply. 
It is wired with the center terminal as the positive supply voltage. The power supply voltage must be
in the range 7V to 15V.

4. Power Supply – 3.3V Regulator
Voltage regulator for the 3.3V power supply. This power supply can provide up to 500mA of current.

5. JP2 – Power Select Jumper
This jumper is used to route power from the external power connector through the on-board 5V voltage
regulator or to bypass the 5V regulator. The REG position routes power through the 5V regulator.
The BYP position bypasses the on-board 5V regulator. With this jumper in the BYP position the maximum
input voltage that can be applied at the external power connector is 6V.

6. Power Supply – 5V Regulator
This on-board 5V voltage regulator regulates the input voltage applied at the external power connector
to 5V. This is used to power the 3.3V regulator and to provide 5V power to expansion shields. This
regulator can provide up to 800mA of current.

7. J2 – Shield Power Connector
This connector provides power to I/O expansion shields connected to the board.

8. PIC32 Microcontroller
The PIC32MX320F128H microcontroller is the main processor for the board.

9. J7 – Analog Signal Connector
This connector provides access to analog/digital I/O pins on the microcontroller.

10. JP6/JP7 – A4/A5 Signal Select Jumpers
These jumpers are used to switch pins 9 and 11 on connector J7 between analog inputs A4 and A5 or the
I²C signals SDA and SCL.

11. J8 – SPI Signal Connector
This connector provides alternative access to the SPI signals. This is used by some shields for access
to the SPI bus.

12. JP5/JP7 – SPI Master/Slave Select Jumpers
These jumpers are used to switch the SPI signals for use of the Uno32 board as an SPI master device or
as an SPI slave device. Both jumpers should be switched together. Place the shorting blocks in the
MASTER position for master operation and in the SLAVE position for slave operation. Normally, these
jumpers are in the MASTER position.

13. User LEDs
Two LEDs connected to digital signal pins 13 and 43.

14. J6 – Digital Signal Connector
This connector provides access to digital I/O pins on the microcontroller.

15. JP4 – Pin 10 Signal Select Jumprt
This jumper is used to switch connector J5 pin 5 (digital signal 10) between pulse width modulator
(PWM) operation and SPI operation. The jumper is placed in the RD4 position for PWM output and in the
RG9 position for SPI slave operation. The shorting block on this jumper will normally be in the RD4
position. The only time it normally needs to be in the RG9 is when using the Uno32 board as an SPI
slave device.

16. J5 – Digital Signal Connector
This connector provides access to digital I/O pins on the microcontroller.

17. J11 - I²C
Dedicated I²C signals. These pins are independent of the setting of jumpers JP6 and JP8. However, if
JP6 and JP8 are in the RG3 and RG2 positions, the I²C signals will be tied to pins A4 and A5 on J7.

18. Communications Status LEDs
These LEDs indicate activity on the USB serial interface.

19. Reset Button
This button can be used to reset the microcontroller, restarting operation from the boot loader.

A documentação completa está em um pseudo PDF que disponibilizo nesse repositório.

Os pinos de IO são tolerantes a sinais 5V, mas o nível lógico é 3v3.

A tabela de pinout pelo pino lógico:

chipKIT Pin #Connector Pin #PIC32 Pin #PIC32 SignalNotes
0J6-0134U1RX/SDI1/RF2
1J6-0333U1TX/SDO1/RF3
2J6-0542IC1/RTCC/INT1/RD8
3J6-0746OC1/RD0
4J6-0959RF1
5J6-1149OC2/RD1
6J6-1350OC3/RD2
7J6-1543IC2/U1CTS/INT2/RD9
8J5-0144IC3/PMCS2/PMA15/INT3/RD10
9J5-0351OC4/RD3
10J5-0552PMWR/OC5/IC5/CN13/RD4Selected by JP4, also on J8-6
11J5-076SDO2/PMA3/CN10/RG8Selected by JP5, also on J8-1
12J5-095SDI2/PMA5/CN8/RG7Selected by JP7, also on J8-4
13J5-114SCK2/PMA5/CN8/RG6Also on J8-3, User LED LD4
14/A0J7-0114C2IN-/AN2/SS1/CN4/RB2
15/A1J7-0312C1IN-/AN4/CN6/RB4
16/A2J7-0521U2CTS/C1OUT/AN8/RB8
17/A3J7-0723TMS/CVREFOUT/PMA13/AN10/RB10
18/A4J7-0927TCK/PMA11/AN12/RB12Selected by JP6
19/A5J7-1129PMALH/PMA1/U2RTS/AN14/RB14Selected by JP8
20/A6J7-0213C2IN+/AN3/CN5/RB3
21/A7J7-0311C1IN+/AN5/CN7/RB5
22/A8J7-0622PMA7/C2OUT/AN9/RB9
23/A9J7-0824TDO/PMA12/AN11/RB11
24/A10J7-1028TDI/PMA10/AN13/RB13
25/A11J7-1230PMALL/PMA0/AN15/OCFB/CN12/RB15
26J6-0260PMD0/RE0
27J6-0461PMD1/RE1
28J6-0662PMD2/RE2
29J6-0863PMD3/RE3
30J6-1064PMD4/RE4
31J6-121PMD5/RE5
32J6-142PMD6/RE6
33J6-163PMD7/RE7
34J5-0253PMRD/CN14/RD5
35J5-0445IC4/PMCS1/PMA14/INT4/RD11
36J5-0654CN15/RD6
37J5-0855CN16/RD7
38J5-1035U1RTS/BCLK1/SCK1/INT0/RF6
39J5-1231PMA9/U2RX/SDA2/CN17/RF4
40J5-1432PMA8/U2TX/SCL2/CN18/RF5
41J5-1615PGC1/AN1/VREF-/CVREF-/CN3/RB1
42J5-1516PGED1/PMA6/AN0/VREF+/CVREF+/CN2/RB0
43N/A58RF0User LED LD5
44J5-058PMA2/SS2/CN11/RG9Selected by JP4, also on J8-6
45J11-1, J7-0936SDA1/RG3J7-09 selected by JP6
46J11-2, J7-1137SCL1/RG2J7-11 selected by JP8

E a tabela de pinout pelo shield:

Connector Pin #chipKIT Pin #PIC32 Pin #PIC32 SignalNotes
J5-01844IC3/PMCS2/PMA15/INT3/RD10
J5-023453PMRD/CN14/RD5
J5-03951OC4/RD3
J5-043545IC4/PMCS1/PMA14/INT4/RD11
J5-0510 or 4452 or 8PMWR/OC5/IC5/CN13/RD4 or SS2/PMA2/CN11/RG9Selected by JP4, also on J8-6
J5-063654CN15/RD6
J5-0711 or 126 or 5SDO2/PMA3/CN10/RG8 or SDI2/PMA5/CN8/RG7Selected by JP5, also on J8-1
J5-083755CN16/RD7
J5-0912 or 115 or 6SDI2/PMA5/CN8/RG7 or SDO2/PMA3/CN10/RG8Selected by JP7, also on J8-4
J5-103835U1RTS/BCLK1/SCK1/INT0/RF6
J5-11134SCK2/PMA5/CN8/RG6Also on J8-3, user LED LD4
J5-123931PMA9/U2RX/SDA2/CN17/RF4
J5-13GND
J5-144032PMA8/U2TX/SCL2/CN18/RF5
J5-154216PGED1/PMA6/AN0/VREF+/CVREF+/CN2/RB0
J5-164115PGC1/AN1/VREF-/CVREF-/CN3/RB1
J6-01034U1RX/SDI1/RF2
J6-022660PMD0/RE0
J6-03133U1TX/SDO1/RF3
J6-042761PMD1/RE1
J6-05242IC1/RTCC/INT1/RD8
J6-062862PMD2/RE2
J6-07346OC1/RD0
J6-09459RF1
J6-103064PMD4/RE4
J6-11549OC2/RD1
J6-12311PMD5/RE5
J6-13650OC3/RD2
J6-14322PMD6/RE6
J6-15743IC2/U1CTS/INT2/RD9
J6-16333PMD7/RE7
J7-01A00/1414C2IN-/AN2/SS1/CN4/RB2
J7-02A06/2013C2IN+/AN3/CN5/RB3
J7-03A01/1512C1IN-/AN4/CN6/RB4
J7-03A07/2111C1IN+/AN5/CN7/RB5
J7-05A02/1621U2CTS/C1OUT/AN8/RB8
J7-06A08/2222PMA7/C2OUT/AN9/RB9
J7-07A03/1723TMS/CVREFOUT/PMA13/AN10/RB10
J7-08A09/2324TDO/PMA12/AN11/RB11
J7-09A04/18 or 4527 or 36TCK/PMA11/AN12/RB12 or SDA1/RG3Selected by JP6
J7-10A10/2428TDI/PMA10/AN13/RB13
J7-11A05/19 or 4629 or 37PMALH/PMA1/U2RTS/AN14/RB14 or SCL1/RG2Selected by JP8
J7-12A11/2530PMALL/PMA0/AN15/OCFB/CN12/RB15
J11-14536SDA1/RG3
J11-24637SCL1/RG2

Uno32 Chipkit no VS Code

Baixe o VS Code para seu sistema nesse link. Depois de instalado, instale o plugin PlatformIO. Então crie um projeto e escolha Uno32 Chipkit. Daí basta usar como Arduino. Veja o vídeo em nosso canal através desse link.

Aproveito para sugerir a inscrição em nosso canal DobitaobyteBrasil no Youtube para prestígio do blog!

Até a próxima!

 

Revisão: Ricardo Amaral de Andrade