OpenCR 1.0 mapping Arduino pins to capabilities


#1

As I mentioned in the UART6 openCR Board thtread, it would be great to have a document that shows what each IO pin on the board is capable of doing, as a way to see about when necessary seeing about adding functionality…

This is a Work in Progress. Currently just extracted data from the datasheet and added first column with Arduino pin numbers and then manually sorted by that number…

I actually have this as an Excel spreadsheet, Next step may be to cleanup some of these coumns… Not sure how to convert the actual logical cells in excel where 2 or 3 rows are grouped into logical cells (Merge and Center).

What I would then like to do is something similar that I have for the Teensy 3.6/3.5 where you then color code some of these cells, by functionality. That is maybe all TX/RX pins used for SerialX would be be color coded some color of RED, maybe I2C some Blue, maybe Wire Green…

Then see about adding functionality, sometimes if or when I might need it. Examples are suppose I wish to use a SerialX object but the default pins are needed for some other functionality. Maybe add the ability to choose the alternate pins.

Example Serial2 is defined to use one of the special connectors. But you might also be able to map it over to use Some IO pins in the Arduino shield area. In particular pins 6 and 9… Again not sure if anyone would want this here, but Again on Teensy boards, we have functions like: Serial2.setTX(6);

Arduino AF0 AF1 AF2 AF3 AF4 AF5 AF6 AF7 AF8 AF9 AF10 AF11 AF12 AF13 AF14 AF15
Pin # SYS TIM1/2 TIM3/4/5 TIM8/9/10/ I2C1/2/3/ 4/CEC SPI1/2/3/ 4/5/6 SPI3/ SAI1 SPI2/3/U SAI2/US CAN1/2/T SAI2/QU ETH/ FMC/SD DCMI LCD SYS
11/LPTIM SART1/2/ ART6/UA IM12/13/ ADSPI/O OTG1_FS MMC1/O
1/CEC 3/UART5/ RT4/5/7/8 /SPDIFR X 14/QUAD TG2_HS/ TG2_FS
SPDIFRX SPI/LCD OTG1_FS
0 PC7 - - TIM3_C H2 TIM8_ CH2 - - I2S3_M CK - USART6 _RX - - - SDMMC DCMI_D 1 LCD_G6 EVEN
1_D7 TOUT
1 PC6 - - TIM3_C H1 TIM8_CH 1 - I2S2_M CK - - USART6 _TX - - - SDMMC DCMI_D 0 LCD_HS YNC EVEN
1_D6 TOUT
2 PG6 - - - - - - - - - - - - - DCMI_D 12 LCD_R7 EVEN
TOUT
PB4 NJTRST - TIM3_C H1 - - SPI1_MI SO SPI3_MI SO SPI2_NS - - - - - - - EVEN
3 S/I2S2_ TOUT
WS
4 PG7 - - - - - - - - USART6 _CK - - - FMC_IN T DCMI_D 13 LCD_CL K EVEN
TOUT
5 PA8 MCO1 TIM1_C H1 - TIM8_BKI N2 I2C3_SC L - - USART1 _CK - - OTG_FS_ SOF - - - LCD_R6 EVEN
TOUT
6 PA2 - TIM2_C H3 TIM5_C H3 TIM9_CH 1 - - - USART2 _TX SAI2_SC K_B - - ETH_MDI O - - LCD_R1 EVEN
TOUT
7 PC1 TRACE D0 - - - - SPI2_M SAI1_SD _A - - - - ETH_MD C - - - EVEN
OSI/I2S2 _SD TOUT
8 PC2 - - - - - SPI2_MI SO - - - - OTG_HS_ ULPI_DIR ETH_MII_ TXD2 FMC_SD NE0 - - EVEN
TOUT
9 PA3 - TIM2_C H4 TIM5_C H4 TIM9_CH 2 - - - USART2 _RX - - OTG_HS_ ULPI_D0 ETH_MII_ COL - - LCD_B5 EVEN
TOUT
PB9 - - TIM4_C H4 TIM11_CH 1 I2C1_SD A SPI2_NS - - - CAN1_T X - - SDMMC DCMI_D 7 LCD_B7 EVEN
10 S/I2S2_ 1_D5 TOUT
WS
11 PB15 RTC_R EFIN TIM1_C H3N - TIM8_CH 3N - SPI2_M - - - TIM12_C H2 - - OTG_HS _DP - - EVEN
OSI/I2S2 _SD TOUT
12 PB14 - TIM1_C H2N - TIM8_CH 2N - SPI2_MI SO - USART3 _RTS - TIM12_C H1 - - OTG_HS _DM - - EVEN
TOUT
PA9 - TIM1_C H2 - - I2C3_SM BA SPI2_SC - USART1 _TX - - - - - DCMI_D 0 - EVEN
13 K/I2S2_ TOUT
CK
14 PB7 - - TIM4_C H2 - I2C1_SD A - - USART1 _RX - - - - FMC_NL DCMI_V SYNC - EVEN
TOUT
15 PB8 - - TIM4_C H3 TIM10_C H1 I2C1_SC L - - - - CAN1_R X ETH_MII_ TXD3 SDMMC DCMI_D 6 LCD_B6 EVEN
1_D4 TOUT
PA0 - TIM2_C TIM5_C H1 TIM8_ET R - - - USART2 _CTS UART4_ TX - SAI2_SD_ B ETH_MII_ CRS - - - EVEN
16 H1/TIM2 TOUT
_ETR
17 PF10 - - - - - - - - - - - - - DCMI_D 11 LCD_DE EVEN
TOUT
18 PF9 - - - - - SPI5_M OSI SAI1_FS _B - UART7_ CTS TIM14_C H1 QUADSPI _BK1_IO1 - - - - EVEN
TOUT
19 PF8 - - - - - SPI5_MI SO SAI1_SC K_B - UART7_ RTS TIM13_C H1 QUADSPI _BK1_IO0 - - - - EVEN
TOUT
PF7 - - - TIM11_CH 1 - SPI5_SC K SAI1_M CLK_B - UART7_T x QUADSP - - - - - EVEN
20 I_BK1_IO TOUT
2
PF6 - - - TIM10_C H1 - SPI5_NS S SAI1_SD _B - UART7_ Rx QUADSP - - - - - EVEN
21 I_BK1_IO TOUT
3
22 PG12 - - - LPTIM1_I N1 - SPI6_MI SO - SPDIFRX _IN1 USART6 _RTS LCD_B4 - - FMC_NE 4 - LCD_B1 EVEN
TOUT
23 PE5 TRACE D2 - - TIM9_CH 1 - SPI4_MI SO SAI1_SC K_A - - - - - FMC_A2 1 DCMI_D 6 LCD_G0 EVEN
TOUT
24 PE4 TRACE D1 - - - - SPI4_NS S SAI1_FS _A - - - - - FMC_A2 0 DCMI_D 4 LCD_B0 EVEN
TOUT
25 PG10 - - - - - - - - - LCD_G3 SAI2_SD_ B - FMC_NE 3 DCMI_D 2 LCD_B2 EVEN
TOUT
26 PG11 - - - - - - - SPDIFRX _IN0 - - - ETH_MII_ - DCMI_D 3 LCD_B3 EVEN
TX_EN/E TOUT
TH_RMII_ TX_EN
27 PE6 TRACE D3 TIM1_B KIN2 - TIM9_CH 2 - SPI4_M OSI SAI1_SD _A - - - SAI2_MC K_B - FMC_A2 2 DCMI_D 7 LCD_G1 EVEN
TOUT
PA4 - - - - - SPI1_NS SPI3_NS USART2 _CK - - - - OTG_HS _SOF DCMI_H SYNC LCD_VS YNC EVEN
28 S/I2S1_ S/I2S3_ TOUT
WS WS
29 PC0 - - - - - - - - SAI2_FS _B - OTG_HS_ - FMC_SD NWE - LCD_R5 EVEN
ULPI_ST P TOUT
30 PC3 - - - - - SPI2_M - - - - OTG_HS_ ETH_MII_ TX_CLK FMC_SD CKE0 - - EVEN
OSI/I2S2 _SD ULPI_NX T TOUT
31 PF14 - - - - I2C4_SC L - - - - - - - FMC_A8 - - EVEN
TOUT
32 PF15 - - - - I2C4_SD A - - - - - - - FMC_A9 - - EVEN
TOUT
PG14 TRACE D1 - - LPTIM1_E TR - SPI6_M OSI - - USART6 _TX QUADSP - ETH_MII_ FMC_A2 5 - LCD_B0 EVEN
33 I_BK2_IO TXD1/ET TOUT
3 H_RMII_T XD1
34 PG3 - - - - - - - - - - - - FMC_A1 3 - - EVEN
TOUT
35 PC12 TRACE D3 - - - - - SPI3_M USART3 _CK UART5_T X - - - SDMMC 1_CK DCMI_D 9 - EVEN
OSI/I2S3 _SD TOUT
PG9 - - - - - - - SPDIFRX _IN3 USART6 _RX QUADSP SAI2_FS_ B - FMC_NE 2/FMC_ NCE DCMI_V SYNC - EVEN
36 I_BK2_IO TOUT
2
PA5 - TIM2_C - TIM8_CH 1N - SPI1_SC - - - - OTG_HS_ ULPI_CK - - - LCD_R4 EVEN
37 H1/TIM2 K/I2S1_ TOUT
_ETR CK
38 PA6 - TIM1_B KIN TIM3_C H1 TIM8_BKI N - SPI1_MI SO - - - TIM13_C H1 - - - DCMI_PI XCLK LCD_G2 EVEN
TOUT
39 PB5 - - TIM3_C H2 - I2C1_SM BA SPI1_M SPI3_M - - CAN2_R X OTG_HS_ ULPI_D7 ETH_PPS _OUT FMC_SD CKE1 DCMI_D 10 - EVEN
OSI/I2S1 _SD OSI/I2S3 _SD TOUT
40 PB0 - TIM1_C H2N TIM3_C H3 TIM8_CH 2N - - - - UART4_ CTS LCD_R3 OTG_HS_ ULPI_D1 ETH_MII_ RXD2 - - - EVEN
TOUT
41 PC8 TRACE D1 - TIM3_C H3 TIM8_ CH3 - - - UART5_ RTS USART6 _CK - - - SDMMC DCMI_D 2 - EVEN
1_D0 TOUT
PA7 - TIM1_C H1N TIM3_C H2 TIM8_CH 1N - SPI1_M - - - TIM14_C H1 - ETH_MII_ FMC_SD NWE - - EVEN
42 OSI/I2S1 _SD RX_DV/E TOUT
TH_RMII_
CRS_DV
PC5 - - - - - - - - SPDIFRX _IN3 - - ETH_MII_ FMC_SD CKE0 - - EVEN
43 RXD1/ET TOUT
H_RMII_ RXD1
44 PB1 - TIM1_C H3N TIM3_C H4 TIM8_CH 3N - - - - - LCD_R6 OTG_HS_ ULPI_D2 ETH_MII_ RXD3 - - - EVEN
TOUT
PC4 - - - - - I2S1_M CK - - SPDIFRX _IN2 - - ETH_MII_ FMC_SD NE0 - - EVEN
45 RXD0/ET TOUT
H_RMII_ RXD0
46 PD10 - - - - - - - USART3 _CK - - - - FMC_D1 5 - LCD_B3 EVEN
TOUT
PB10 - TIM2_C H3 - - I2C2_SC L SPI2_SC - USART3 _TX - - OTG_HS_ ULPI_D3 ETH_MII_ RX_ER - - LCD_G4 EVEN
50 K/I2S2_ TOUT
CK
PB11 - TIM2_C H4 - - I2C2_SD A - - USART3 _RX - - OTG_HS_ ULPI_D4 ETH_MII_ - - LCD_G5 EVEN
51 TX_EN/E TOUT
TH_RMII_ TX_EN
52 PC13 - - - - - - - - - - - - - - - EVEN
TOUT
53 PD2 TRACE D2 - TIM3_ET R - - - - - UART5_ RX - - - SDMMC 1_CMD DCMI_D 11 - EVEN
TOUT
54 PE3 TRACE D0 - - - - - SAI1_SD _B - - - - - FMC_A1 9 - - EVEN
TOUT
55 PG2 - - - - - - - - - - - - FMC_A1 2 - - EVEN
TOUT
56 PE10 - TIM1_C H2N - - - - - - UART7_ CTS - QUADSPI _BK2_IO3 - FMC_D7 - - EVEN
TOUT
57 PE11 - TIM1_C H2 - - - SPI4_NS S - - - - SAI2_SD_ B - FMC_D8 - LCD_G3 EVEN
TOUT
58 PE12 - TIM1_C H3N - - - SPI4_SC K - - - - SAI2_SC K_B - FMC_D9 - LCD_B4 EVEN
TOUT
59 PE13 - TIM1_C H3 - - - SPI4_MI SO - - - - SAI2_FS_ B - FMC_D1 0 - LCD_DE EVEN
TOUT
60 PE14 - TIM1_C H4 - - - SPI4_M OSI - - - - SAI2_MC K_B - FMC_D1 1 - LCD_CL K EVEN
TOUT
61 PE15 - TIM1_B KIN - - - - - - - - - - FMC_D1 2 - LCD_R7 EVEN
TOUT
62 PF0 - - - - I2C2_SD A - - - - - - - FMC_A0 - - EVEN
TOUT
63 PF1 - - - - I2C2_SC L - - - - - - - FMC_A1 - - EVEN
TOUT
64 PF2 - - - - I2C2_SM BA - - - - - - - FMC_A2 - - EVEN
TOUT
65 PD8 - - - - - - - USART3 _TX SPDIFRX _IN1 - - - FMC_D1 3 - - EVEN
TOUT
66 PF4 - - - - - - - - - - - - FMC_A4 - - EVEN
TOUT
67 PD9 - - - - - - - USART3 _RX - - - - FMC_D1 4 - - EVEN
TOUT
70 PF12 - - - - - - - - - - - - FMC_A6 - - EVEN
TOUT
71 PF11 - - - - - SPI5_M OSI - - - - SAI2_SD_ B - FMC_SD NRAS DCMI_D 12 - EVEN
TOUT
72 PF5 - - - - - - - - - - - - FMC_A5 - - EVEN
TOUT
73 PE9 - TIM1_C H1 - - - - - - UART7_ RTS - QUADSPI _BK2_IO2 - FMC_D6 - - EVEN
TOUT
74 PE8 - TIM1_C H1N - - - - - - UART7_T x - QUADSPI _BK2_IO1 - FMC_D5 - - EVEN
TOUT
75 PF3 - - - - - - - - - - - - FMC_A3 - - EVEN
TOUT
80 PD6 - - - - - SPI3_M SAI1_SD _A USART2 _RX - - - - FMC_N WAIT DCMI_D 10 LCD_B2 EVEN
OSI/I2S3 _SD TOUT
81 PD5 - - - - - - - USART2 _TX - - - - FMC_N WE - - EVEN
82 PE0 - - TIM4_ET R LPTIM1_E TR - - - - UART8_ Rx - SAI2_MC K_A - FMC_NB L0 DCMI_D 2 - EVEN
TOUT
83 PE1 - - - LPTIM1_I N2 - - - - UART8_T x - - - FMC_NB L1 DCMI_D 3 - EVEN
TOUT

#2

I have been playing around some with this, and added some additional columns, including Analog pin information, which appears to have a different initialization of, then simply having a alternate usage field…
OpenCR Pins.pdf (276.6 KB)

I saved the word file as a PDF, not as good as XLS for this but someone might find this WIP interesting and probably better than the cut/paste above. Again warning WIP…

Some of the things I have been toying with is maybe seeing how hard it would be to add some functionality.

For example:

Analog pins:

Not all of the pins on the board that are Analog capable are setup to do so. Examples: Arduino pins (6-9, the IMU pins, 44, 66) some of these could be marked in pin table as Analog capable. Obviously the IMU pins would not work here as signals not available. Also there is an issue with Arduino API, where analogRead(6), would typically imply A6… But could probably easily adjust as this board does not have A6… Wondering if anyone would need/want more pins for Analog?

SerialX

Not sure yet, there are several IO pins that have Serial capabilities. Currently all used ones are USART (USART 6, 2, 8, 3), but the board also has UARTS. How hard would it be to use these? Could we use UART4 on Serial4 instead of USART3 (BT2 serial), which would free up USART3 which could go on expansion pins 50, 51…

Wire/I2C

Looks like we could probably have another Wire object that uses expansion pins (50,51) or (62,63)

SPI

Again looks like maybe could have another SPI buss using expansion pins (57-60)


But again I guess the question is, would anyone be interested in having these capabilities? I could for example see using @ROBOTIS-Will example code using a Camera and Display where the camera and display are on two different SPI busses and maybe be able to do concurrent DMA access…

But now back to playing with turtle!


#3

Still WIP,
But today played around with creating an SPI object(SPI4) using pins 57-60.
As I mentioned up on Robotis Forum, I am not sure yet how DMA works, will test:

I also updated my own branch of the Adafruilt_SSD1306 driver to work with OPENCR In this branch I had previously added support for specifying which SPI object to use.

So I first verified I could use one of my cheap 128x64 SPI based 1306 displays, and first made sure it worked on the default SPI object. I then verified it worked on the new SPI object… So far it is not using any of the DMA stuff, just the basic SPI support.

Anyway I pushed up the SPI changes to my OpenCR fork/branch:

I also pushed up my changes to the SSD1306 code.

I can also push up the changes I made to the example program or post here.

Note: My SPI changes also included a few extra things as well, like, implemented the
SPI.transfer(buffer, cnt) method as Adafruit used it.

Next up try to make a version that uses the DMA support. (transferFast ?). My quick look, appears like I need to call something like beginFast instead of begin? Will figure it out.

Wondering if it would make sense to simply have the transferFast check to see if the DMA had been previously init…

I wonder if some of this, I should discuss here? Or should some of this be a github issue?

Now back to playing!

Thanks


SPI APIs of OpenCR
(Kei) #5

And I think that we need to create a separate Topic to handle SPI issues.


(Will Son) #6

@Kurt

Sorry, I was writing a reply and totally forgot to upload it yesterday. We’ve been busy for preparing to move to our new shiny building!! Yay!

I’ve also referred a lot to the Alternate Function Mapping table of the Datasheet which really helped me to figure out which pin to use for a specific function.

For Analog pins, I hope 10 ADC(A0~A5, OLLO 1~4) would be enough for most developers, but sensors are never enough sometimes especially when developing for a prototype. We’ll see if there’s any request for more analog inputs.

I think it shouldn’t be too much difficult to use Dynamixel Ports for UART4 function, but still it may require changes in the driver file. Maybe we could have a separate UART initialization file that receives pin numbers. We’ll think about this not only for UART but also for others like I2C and SPI.

Using a concurrent DMA for camera and LCD is a great idea! Although I might need some time to figure out how this will work. For now, I took an easy step for getting an image from FIFO of the camera module and then modified acquired data for information display as well as reducing its size.
I’m very excited that my example code can be improved in many ways :smiley:

For assigning DMA, you can refer to the Reference manual page 222.


They are defined by default so I don’t think we can modify as we want to use.


#7

Thanks, I somehow missed the two tables that assigned the DMA channels/streams… So now to update the code and try it out.

WIll continue the SPI talking on the new thread.


#8

I did a little more editing of the Excel document…
Here is an updated PDF file generated from it:
OpenCR Pins.pdf (289.2 KB)

Also if you wish to play with the actual excel document. I put a zip file of it up on Trossen Robotics forum:
http://forums.trossenrobotics.com/showthread.php?10168-The-Robotis-TurtleBot3&p=93941#post93941


(Will Son) #9

@Kurt
You are the best. There’ll be many people who would appreciate for this and I think I’m the first one xD
Thank you!