svcguy 4 Posted December 14, 2014 Share Posted December 14, 2014 Hello all, Love the site and have found a ton of useful information here! I have a question regarding hardware serial on a CC3200 launchpad (rev 4.1). I have found the pinmaps at http://energia.nu/pin-maps/guide_cc3200launchpad/ and they reference TX/RX, TX(0)/RX(0), and TX(1)/RX(1). I was looking for clarification on how these relate to Serial, Serial1, etc. I have a project that uses I2C and UART and would like to keep the FTDI UART as well for debug. P.S. a similar question was asked here, but this particular part was not answered Thanks, Andy Quote Link to post Share on other sites
igor 163 Posted December 14, 2014 Share Posted December 14, 2014 Look at the manual gives possible pin functions swru367a.pdf - Table 16-7 - page 491-492 A quick look at the manual looks like RX/TX are for serial 0. The pins labeled RX(0) and TX(0) can be multiplexed to either RX(0)/RX(1) or TX(0)/TX(1). Looks like some other pins could be used (would have to tweak the Energia code to use them). E.g. package pins 58, 59, 62 Look at the code for energia - cc3200\cores\cc3200\HardwareSerial.cpp Looks like Serial 0 is set to use pins labeled RX(0) and TX(0) Serial 1 is set to use pins labeled TX(1) and RX(1) Do not see where RX and TX are set up. The diagram could be improved by note explaining what RX/TX are. svcguy 1 Quote Link to post Share on other sites
svcguy 4 Posted December 15, 2014 Author Share Posted December 15, 2014 Do not see where RX and TX are set up. The diagram could be improved by note explaining what RX/TX are. The only thing I found is that the schematic seems to label them as TX/RX for some reason - maybe just copied over? The manual says that package pins 3, 4 (GPIO_12, GPIO_13) can be multiplexed to UART0_TX, UART0_RX. However, this would blow up using this UART for debug. Looks like some other pins could be used (would have to tweak the Energia code to use them). Package pins 58, 59 would be the only other possible targets (PIN_MODE_6?). They would require making sure the analog is shut off first, I think. What would be the high-level procedure to modify Energia to use these? Thanks, Andy Quote Link to post Share on other sites
svcguy 4 Posted December 15, 2014 Author Share Posted December 15, 2014 Could it be as simple as changing this (HardwareSerial.cpp): static const unsigned long g_ulUARTBase[2] = { UARTA0_BASE, UARTA1_BASE }; //***************************************************************************** // // The list of possible interrupts for the console UART. // //***************************************************************************** static const unsigned long g_ulUARTInt[2] = { INT_UARTA0, INT_UARTA1 }; //***************************************************************************** // // The list of UART pin modes. // //***************************************************************************** static const unsigned long g_ulUARTPinmode[2] = { PIN_MODE_3, PIN_MODE_7 }; //***************************************************************************** // // The list of UART peripherals. // //***************************************************************************** static const unsigned long g_ulUARTPeriph[2] = { PRCM_UARTA0, PRCM_UARTA1 }; //***************************************************************************** // // The list of UART GPIO configurations. // //***************************************************************************** static const unsigned long g_ulUARTConfig[2][2] = { {PIN_57, PIN_55}, {PIN_02, PIN_01} }; void (*g_UARTIntHandlers[2])(void) = { UARTIntHandler, UARTIntHandler1 }; To this: static const unsigned long g_ulUARTBase[3] = { UARTA0_BASE, UARTA1_BASE, UARTA1_BASE }; //***************************************************************************** // // The list of possible interrupts for the console UART. // //***************************************************************************** static const unsigned long g_ulUARTInt[3] = { INT_UARTA0, INT_UARTA1, INT_UARTA1 }; //***************************************************************************** // // The list of UART pin modes. // //***************************************************************************** static const unsigned long g_ulUARTPinmode[3] = { PIN_MODE_3, PIN_MODE_7, PIN_MODE_6 }; //***************************************************************************** // // The list of UART peripherals. // //***************************************************************************** static const unsigned long g_ulUARTPeriph[3] = { PRCM_UARTA0, PRCM_UARTA1, PRCM_UARTA1 }; //***************************************************************************** // // The list of UART GPIO configurations. // //***************************************************************************** static const unsigned long g_ulUARTConfig[3][2] = { {PIN_57, PIN_55}, {PIN_02, PIN_01}, {PIN_59, PIN_58} }; void (*g_UARTIntHandlers[3])(void) = { UARTIntHandler, UARTIntHandler1, UARTIntHandler1 }; And then start it with this: Serial1.begin(9600); Serial1.setModule(2); It feels hack-ish, but would that work? Quote Link to post Share on other sites
svcguy 4 Posted December 16, 2014 Author Share Posted December 16, 2014 Above doesn't work, hangs shortly after the .setModule(2). I guess I'll let the pros handle it... Quote Link to post Share on other sites
svcguy 4 Posted December 18, 2014 Author Share Posted December 18, 2014 I noticed that in HardwareSerial.h, setPins is declared, but not implemented in HardwareSerial.cpp. So I had a go at it and this is the result. Contributing code to Energia is out of my league, but maybe someone much more skilled than I could use this. It's not fully implemented. According to the reference manual, pins 58 and 59 can be muxed to UART1, but care must be taken that the analog paths are disabled. My thought was that setPins() would return -1 if it was a bad config, would return 0 if the resulting configuration would be dangerous (short analog to digital, overlap with UART0) and return 1 if good. Anyway, I tested it against launchpad pins 32, 31 and it works which is good for my application. Here's the code: HardwareSerial.h int setPins(unsigned long); HardwareSerial.cpp //***************************************************************************** // // The list of allowable pin mux configs. // //***************************************************************************** static const unsigned long g_ulUARTPinMuxConfig[5][3] = { // RX_PIN, TX_PIN, PIN_MODE {PIN_02, PIN_01, PIN_MODE_7}, {PIN_08, PIN_07, PIN_MODE_5}, {PIN_17, PIN_16, PIN_MODE_2}, // 55, 57 would overlap with default config of UARTA0 {PIN_57, PIN_55, PIN_MODE_6}, // 58, 59 require the analog input to be turned off first, if enabled {PIN_59, PIN_58, PIN_MODE_6} }; int HardwareSerial::setPins(unsigned long pins) { // Bounds check if(pins < 0 || pins > 5) return -1; // pins == 3 is pin55, pin57 need to check that UARTA0 is not setup on these pins (TODO) if(pins ==3) return 0; // pins == 4 is pin58, pin59 need to check that analog path is disabled, otherwise // device may be damaged (TODO) if(pins == 4) return 0; // Disable interrupts MAP_UARTIntDisable(UART_BASE, UART_INT_RX | UART_INT_RT | UART_INT_TX); // Disable UART MAP_UARTDisable(UART_BASE); // Reconfigure pins MAP_PinTypeUART(g_ulUARTPinMuxConfig[pins][0], g_ulUARTPinMuxConfig[pins][2]); MAP_PinTypeUART(g_ulUARTPinMuxConfig[pins][1], g_ulUARTPinMuxConfig[pins][2]); // Reset peripheral MAP_PRCMPeripheralReset(g_ulUARTPeriph[uartModule]); MAP_PRCMPeripheralClkEnable(g_ulUARTPeriph[uartModule], PRCM_RUN_MODE_CLK); // Reconfigure UART MAP_UARTConfigSetExpClk(UART_BASE, 80000000, baudRate, (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | UART_CONFIG_WLEN_8)); flushAll(); // Enable UART MAP_UARTEnable(UART_BASE); // Enable interrupts MAP_UARTIntEnable(UART_BASE, UART_INT_RX | UART_INT_RT | UART_INT_TX); return 1; } Andy gr8going 1 Quote Link to post Share on other sites
slider 0 Posted January 8, 2015 Share Posted January 8, 2015 @@svcguy It works fine. Thank you. Quote Link to post Share on other sites
gr8going 0 Posted March 31, 2016 Share Posted March 31, 2016 Hi experts!! I'm a beginner and working on CC3200 LP along with Energia IDE. I'm working on a simple project where I've an external device which has RS485 o/p and I need to fetch the values in specified addr location in that device to CC3200 LP. My doubts are #1) we have external module that has device ID+parameter Address and we need to transmit the value in LP through UART, here I'm not sure how to use the UART function to specifically target device+address and return/get the same.... #2) what I'm looking/exploring is that in above example (UART code which Andy shared ) what function specifically reads DeviceID+parameter Addr and returns that string value to my LP My experiments: I've been checking uart.h file and following lines looks close to what I need to do - but not sure... extern void UARTConfigSetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long ulBaud, unsigned long ulConfig); extern void UARTConfigGetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long *pulBaud, unsigned long *pulConfig); I'm planning to have my framework Energia sketch might be like calling below functions in specified order 1) UARTIntClear ==> to initialize/clear in LP 2) UARTIntEnable ==> enable UART of my LP 3) UARTConfigSetExpClk ==> to set what I need to read from the external device to my LP 4) UARTConfigGetExpClk ==> to GET what I need to read from the external device to my LP 5) perform step 1 to 4 after 5 sec ==> loop it Am I missing something in above flow?? My Setup I've installed Tera Term in my PC to monitor com port I've got Rs485 to RS232/TTL converter which can be connected to my cc3200 LP UART PIN_02, PIN_01 (RX_1 & TX_1) ... or nay other UART pin which is applicable. my external device which has RS485 o/p ==> Baud rate of 9600, Parity = Even, Device Address = 1, Stop bit = 1, Data type = 32 bit float real, Data to be red from address (Float) 3913, 3909, 3903, 3965, please advice Quote Link to post Share on other sites
bluehash 1,581 Posted March 31, 2016 Share Posted March 31, 2016 Hi experts!! I'm a beginner and working on CC3200 LP along with Energia IDE. I'm working on a simple project where I've an external device which has RS485 o/p and I need to fetch the values in specified addr location in that device to CC3200 LP. My doubts are #1) we have external module that has device ID+parameter Address and we need to transmit the value in LP through UART, here I'm not sure how to use the UART function to specifically target device+address and return/get the same.... #2) what I'm looking/exploring is that in above example (UART code which Andy shared ) what function specifically reads DeviceID+parameter Addr and returns that string value to my LP My experiments: I've been checking uart.h file and following lines looks close to what I need to do - but not sure... extern void UARTConfigSetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long ulBaud, unsigned long ulConfig); extern void UARTConfigGetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long *pulBaud, unsigned long *pulConfig); I'm planning to have my framework Energia sketch might be like calling below functions in specified order 1) UARTIntClear ==> to initialize/clear in LP 2) UARTIntEnable ==> enable UART of my LP 3) UARTConfigSetExpClk ==> to set what I need to read from the external device to my LP 4) UARTConfigGetExpClk ==> to GET what I need to read from the external device to my LP 5) perform step 1 to 4 after 5 sec ==> loop it Am I missing something in above flow?? My Setup I've installed Tera Term in my PC to monitor com port I've got Rs485 to RS232/TTL converter which can be connected to my cc3200 LP UART PIN_02, PIN_01 (RX_1 & TX_1) ... or nay other UART pin which is applicable. my external device which has RS485 o/p ==> Baud rate of 9600, Parity = Even, Device Address = 1, Stop bit = 1, Data type = 32 bit float real, Data to be red from address (Float) 3913, 3909, 3903, 3965, please advice Welcome! Please start your own thread in the CCXXXX forum. gr8going 1 Quote Link to post Share on other sites
gr8going 0 Posted March 31, 2016 Share Posted March 31, 2016 Thanks Admin! I've started a new here Quote Link to post Share on other sites
gr8going 0 Posted May 30, 2016 Share Posted May 30, 2016 The only thing I found is that the schematic seems to label them as TX/RX for some reason - maybe just copied over? The manual says that package pins 3, 4 (GPIO_12, GPIO_13) can be multiplexed to UART0_TX, UART0_RX. However, this would blow up using this UART for debug. Package pins 58, 59 would be the only other possible targets (PIN_MODE_6?). They would require making sure the analog is shut off first, I think. What would be the high-level procedure to modify Energia to use these? Thanks, Andy Hi Andy I'm referring to this post which I recently updated seeking for some guidance. I'm using cc3200 LP and now facing conflict between UART1 (Serial1) Vs I2C where default ports mentioned are 9 and 10 (P01 and P02) for both!! can we have I2C configured or multiplexed to some other GPIO ports? if so how? Thanks! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.