Lessons

Build Your Own Robot from Scratch

 

27 Comments

  • magna Posted July 23, 2016 2:50 pm

    Great content

  • Naelbest Posted August 20, 2016 6:54 am

    Superb!
    I have got one question while reading your content. In ADC and Analog Sensors,
    … Output voltage = Vin /step size = 1.8V /11.7mV = 153.6 , round to 170
    170 = 10101010 in binary

    Why did you choose 170 to round from the given number?
    Why not 154 or 160?

  • Alex Posted August 24, 2016 4:25 pm

    Yow to change UART code to use UART1 unstead UART0?

    • magna Posted August 24, 2016 5:48 pm

      Change 1
      You will have to change these two line

      SYSCTL->RCGCUART |= 1; /* provide clock to UART0 */
      SYSCTL->RCGCGPIO |= 1; /* enable clock to PORTA */

      to :

      SYSCTL->RCGCUART |= 0x02; /* provide clock to UART1 */
      SYSCTL->RCGCGPIO |= 0x02; /* enable clock to PORTB*/

      This is because in the RCGCUART register, bit 2 controls the clock of UART1 and also the RX and TX pins of UART1 are PB0 and PB1 respectively hence you need to provide clock to PORTB. There are 7 UARTs on the TM4C123 to take a look at the RCGCUART (Uart Clock Gating Register) and also the UART connections to the various GPIO pins, follow this link :http://cortex-m.com/uart_diagrams/

      Change 2
      You have to replace UART0 with UART1 everywhere in the example code

      Change 3
      You have to replace this piece of code

      GPIOA->DEN = 0x03; /* Make PA0 and PA1 as digital */
      GPIOA->AFSEL = 0x03; /* Use PA0,PA1 alternate function */
      GPIOA->PCTL = 0x11; /* configure PA0 and PA1 for UART */

      with :

       GPIOB->DEN = 0x03; /* Make PB0 and PB1 as digital */
       GPIOB->AFSEL = 0x03; /* Use PB0,PB1 alternate function */
       GPIOB->PCTL = 0x11; /* configure PB0 and PB1 for UART */
      

      Your code should be working perfectly with UART1 after making these changes.

  • Tapas Posted November 23, 2016 8:43 am

    I am interested in making real time low pass filter using DSP, can it be possible in Tiva C micocontroller. If yes, are you teaching in the course.

    • Tapas Posted November 23, 2016 8:47 am

      * microcontroller

    • magna Posted November 25, 2016 1:29 am

      The Tiva C runs on an ARM Cortex-M4 therefore it should be able to offer enough DSP capabilities for your application. However, the current courses do not cover DSP solutions.

  • Hafsa Jamal Posted December 23, 2016 8:08 am

    i wont be able to see the source code for DAC and sounds outputs

    • magna Posted December 23, 2016 10:53 pm

      Hi Hafsa, the post for that lesson is not currently available

      • Hafsa Jamal Posted January 12, 2017 5:58 pm

        what if i want to interface multiple ultrasonic sensor with tiva. how could i change the code given by this website. kindly help me

  • Hafsa Jamal Posted January 12, 2017 5:57 pm

    what if i want to interface multiple ultrasonic sensor with tiva. how could i change the code given by this website. kindly help me

    • magna Posted January 12, 2017 7:09 pm

      hello hafsa,you can enable one timer for each ultrasonic sensor and then go through the same procedure as shown in the example

  • Hafsa Jamal Posted January 12, 2017 8:36 pm

    lowEdge = TIMER0->TAR;
    what is meant by this instruction given in the code?

    • magna Posted January 13, 2017 8:21 pm

      The timestamp of the edge detection is stored in the TAR register, so we store the timestamp in local variable called lowEdge, hence the instruction lowEdge = TIMER0->TAR; . Which microcontroller are you running on ?

  • Hafsa Jamal Posted January 12, 2017 8:38 pm

    i dont know why the code is not working

    • magna Posted February 4, 2017 10:43 pm

      Could you send me a screenshot of your work?

  • Hafsa Jamal Posted January 15, 2017 6:21 pm

    How do you calculate the MAX_TIME 7500 in program2 of ultrasonic sensor interfacing

  • Ahmed Posted February 3, 2017 12:50 pm

    Hi,

    I am using your code for the hc-sr04 on tiva c but i keep getting random values with lots of zeros in them. I am displaying the distance on console using uart0. I thought may be the sensor is bad so I tried it on arduino and it seems to be working fine and it gives pretty accurate and consistent results too, that’s why I am thinking that there must be something wrong with either the code or the 3.3V trigger voltage from the tiva C not strong enough to trigger the sensor. I have also built a level shifter using two bc547 transistors to up the tigger voltage from 3.3V to 5V but still no difference.

  • Ahmed Posted February 3, 2017 8:21 pm

    I just figured out the problem. i was powering the sensor from an external power source and after i powered the sensor directly from the tiva c board everything worked fine.

    • magna Posted February 4, 2017 10:41 pm

      GOOD. Remember, if you power the sensor from an external source, you must tie the ground of the source and that of the MCU.

  • isaac romero Posted February 23, 2017 2:32 am

    This page is greaaatt, it always helps me with my homework, Greetings from Bogotá Colombia =D

    • magna Posted February 24, 2017 9:45 pm

      Greetings from London

  • oliver Posted February 24, 2017 2:22 pm

    There are some errors detected in the compilation.maybe I got it wrong,could you help me?
    “../main.c”, line 25: error #20: identifier “GPIOA” is undefined
    “../main.c”, line 44: error #20: identifier “SysCtl” is undefined
    “../main.c”, line 45: error #20: identifier “SYSCTL” is undefined
    “../main.c”, line 46: error #20: identifier “GPIOA” is undefined
    “../main.c”, line 47: error #20: identifier “GPIOF” is undefined
    “../main.c”, line 66: error #20: identifier “SYSCTL” is undefined
    “../main.c”, line 67: error #20: identifier “TIMER1” is undefined

    • magna Posted February 24, 2017 9:44 pm

      hello oliver, this may be because you have not include the header file. Right click ->Include -> TM4C123.h

      • oliver Posted February 25, 2017 3:36 am

        sorry,i cannot find TM4C123.h in my computer .

        • magna Posted March 28, 2017 9:33 pm

          Hello Oliver,

          You will have to right click in your project main.c file and selece “Insert ‘#include file’ ”

          Regards.

Add Comment

Your email address will not be published. Required fields are marked *

Phone: +447586761483
SW11 2DL London UK
Winstanley Rd,
Style switcher RESET
Body styles
Color settings
Link color
Menu color
User color
Background pattern
Background image