This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

uart output

Other Parts Discussed in Thread: MAX232, TLC5916, TLC59211, DRV8806

hi, the board im using is a tm4c123gxl with keil uvision 4.73. im trying to output a variable value to the uart using printf. im taking a course on edx but am unable to get information about how to output a variable value to the uart without converting it to an array. im also looking to be able to use printf as the output as im familiar with that vs uart_outstring this is in c. 

  • Hello Dirk

    you can use UARTprintf("%x",variable); to print as regular strings. Do make sure that you call uartstdio.c and uartstdio.h from the utils directory in TIVAWare

    Regards

    Amit

  • and that prints to whatever uarts i have setup?

  • Hello Dirk

    It works with UART0 but can be modified for other UART's. Also you would need a MAX232 IC if you want to connect it to any other UART. UART-0 on the launch pad is interfaced via the ICDI

    Regards

    Amit

  • Dirk deBoer said:
    how to output a variable value to the uart without converting it to an array. im also looking to be able to use printf as the output as im familiar with that vs uart_outstring this is in c. 

     Hi Dirk, converting to array I suppose sound as converting to string so you can patch character output underlying printf() or simply use sprintf:

    char mystring[80];

    int a;

    a=123;

    sprintf(mystring,"Everything is done on printf .. integer =  %d \n",a);

    uart_outstring(mystring);

     If this can be acceptable can solve what you need otherwise you need redirect stdout as I wrote.

  • Amit Ashara said:
    you would need a MAX232 IC if you want to connect it to any other UART.

    Perhaps a note of caution is needed here?  Quote above holds true if - and only if - the (other) targeted UART expects & generates RS232 signal levels!  Then - indeed MAX232 (or similar, level shifter) is required.

    But - if instead MCU to a "non-RS232 UART" communication is attempted (and that's a clear possibility) then the imposition of that RS232 level shifter will likely cause damage to the (other) UART's RX pin!  Clearly - that's not good...

    More precise language would read, "An RS232 level shifter (brand agnostic) is required if the targeted UART employs RS232 signal levels.  If only MCU/CMOS levels are employed - no such level shifter is required."

  • thats a good point but this is only for debugging right now. im creating a battleship program so i want to output data back to my computer as it runs so i know everything is working like i want it to. and later im gonna build an led cube with it using a tlc5916. i know for that i just need to push bits out and then latch them in but does the serial interface have a limit of how many bits can get pushed out at once. because its 64 chips i need to drive (8x8x8 individual control) which i might have to split over 2 uarts. unless i learn i2c or another protocol. i cant use smt chips because im doing this on protoboard and i dont have the tools to solder smt at home. but if i dont have an option i can get the equipment needed. 

  • Dirk deBoer said:
    need to drive (8x8x8 individual control) which i might have to split over 2 uarts. unless i learn i2c or another protocol.

    Were not parallel ports invented for just such requirements?  Unless those cubes are "far" from your MCU - appears that 8 bits via any available parallel port would be far faster - and would enable "sync" between each cube...

  • so more like a tlc59211? do you know by chance how to cascade those or is it just keep pushing bits down the line?

  • I'd have to download then review those parts - know just their general functionality.

    Years back (decades - a score really) - prior to the introduction of character Lcd modules - we employed multiple, individual, 5x7 Led matrix modules from HP - to create/sell, "readouts for autos/trucks/marine."  And - serial just proved "too slow!"  So parallel - and parallel from multiple parallel ports - proved our answer.

    Now it may be that those cubes employ some form of display multiplexing (whereby only one Led is "on" at any given moment in time - but "persistence of human vision" makes it appear that all are (always) on.)  That said - if UART is the "transport mechanism" (MCU to each cube) it should be possible to drive multiple cubes in parallel - and secure far faster data/update rates - perhaps even reduce the cube's component count - via your parallel port...

    Devil (as always) in the details - suggest you further review the cube lit. & see if parallel feed makes sense. (surely did for us - as we awaited the early, "non-HD44780 based" character Lcd modules...)

  • its something to think about. unfortunately i think part of my limitation is the fact im trying to drive a ton of pins using not too many. i think my best solution though its serial in, parallel out and then use multiple serials to drive all the separate drivers. or studying up on multiplexing like you said. 

  • This horse just about exhausted now.  (and there are fine such beasts - about to run 1st Sat in May - shortly)  You may note the many fine, "hat wearers" as well...

    You may consider the SPI modules - should be several - your MCU.  These can provide clocked serial - likely faster & more robustly than simple UART.  Then - at the cube/receive side - you may employ fairly elementary SIPO IC (HC595 shifter - iirc - works especially well - we like it as the data shifting may be isolated from the outputs - until all shifting completes!)

    Review of the cube's inner workings seems important - but we've moved beyond MCU issue & others (and betting window) now await...

  • Dirk deBoer said:
    tlc59211?

     Hi Dirk, this is not a serial device like uart and you cannot use printf too. this is a parallel driver, you need latch data and again load serial data with additional IC like the HCT595. Or use some parallel latch.. (don't do that, fast SPI can be more simple and efficient)

     Select an SPI device and of not too far from cpu you can drive at max speed obtaining what you need, cascading is done connecting out of first to in of next and sending out all serial string before to latch.

     See for example drv8806, it is not suited for your task but datasheet show you how to cascade.

     3D Led cube work well on MSP, TIVA has more fast SPI and more than one so you can speed up if you wish build a large cube. 8*8*8 is enough on an MSP running at bare 8MHz with pwm'ing  all led. I am not sure but someone also build an RGB version too.

  • One notes now - two votes for HC/T595.  

    Poster may wish to "throw in" an occasional "cap" - to render text bit more legible...

  • cb1_mobile said:
    Poster may wish to "throw in" an occasional "cap" - to render text bit more legible...

     This forum has some trouble.. IMHO has to be split in professional/beginners and not leave intermixed as is.

     We collect two many children screaming about his broken toy or where not able to build the space ship they bought on play game store...