Jump to content

Lyon

Members
  • Content Count

    193
  • Joined

  • Last visited

  • Days Won

    7

Reputation Activity

  1. Like
    Lyon got a reaction from roadrunner84 in Extremely simple ARM assembly example with Tiva C?   
    HI,
     

    Well, while it is possible to do such small program as you do for MSP430, you must take into account the major differences between MSP430 and Cortex-M4: the latest imposes some discipline in program writing. This is due to hardware realization of the inside circuitry of Cortex.    First flash location is at address 0 and in this location must reside the address of stack pointer, even if it is not used. The second location is the address of startup routine; this must be also present; at startup the processor uses these two locations and then goes further, so you must provide them. This address and the rest of interrupt vectors must have the last bit set to 1, making it odd number, despite even alignment - this last bit is internal signal for thumb interrupt - as requested by ARM. Note this is compiler's job, but directed by you.   Next, after these two locations, there must be the rest of interrupt vectors locations, properly initialized. You need these also - otherwise you will be soon in trouble, at the first mistake. You must know also this processor is provided with a unusual big and complex debug and diagnostic machine - so fault interrupts must be really initialized and a code body provided for them. So this is why in general, you must use two files for every small program (and Valvano is best to follow and learn from):  - one is a startup.S, which is written only once; - the other one is main.S which is your program.   I understand your pain - this is not so simple - and using IAR is an add-on, since no example - of coarse you must read/learn IAR documentation - however an example written in IAR assembler can be found in TIVA/boot_loader/bl_startup_ewarm.S - you can copy/paste from that file a lot...   Hope this will help you,
  2. Like
    Lyon got a reaction from bluehash in Flashing a Tiva Launchpad under OSX   
    Hi,
    A nice GUI for MAC can be build from Eclipse + the plugin from this link: http://gnuarmeclipse.github.io
    The result is something powerful as CCS, if you add openOCD.
    Also openOCD can be used from terminal, so you have another tool to flash a .bin file.
  3. Like
    Lyon got a reaction from tripwire in Execution time - the easy way   
    Hi,
    Found on web several postings related to some available, but unused hardware on Cortex-Mx processors (unused on some platforms, available on others.
    Adapted for TM4C as below:
    #include "inc/hw_nvic.h" /* for definition of NVIC_DBG_INT */ #include "inc/hw_memmap.h" /* for definition of DWT_BASE */ #include "inc/hw_types.h" /* for definition of HWREG */ #define DWT_O_CYCCNT 0x00000004 static  uint32_t     c_start, c_stop; // declaration of an initialization function void EnableTiming(void); // definition of that function /******************************************************************************/ void EnableTiming(void){    HWREG(NVIC_DBG_INT) |= 0x01000000;      /*enable TRCENA bit in NVIC_DBG_INT*/    HWREG(DWT_BASE + DWT_O_CYCCNT) = 0;   /* reset the counter */    HWREG(DWT_BASE) |= 0x01;                /* enable the counter */    enabled = 1; } /******************************************************************************/ // and then, in the code to be examined write these: EnableTiming();  c_start = HWREG(DWT_BASE + DWT_O_CYCCNT); // at the beginning of the tested code  // your code follows here  c_stop = HWREG(DWT_BASE + DWT_O_CYCCNT); // at the end of the tested code // then c_stop - c_start is the execution number of cycles for the code; // just multiply with clock period to find out the execution time of the code. // At 80MHz, the 32 bit counter gives you a total time 2^32 x 12.5ns = ~53 seconds! // Another interesting function is this one /**********************************************************/ void TimingDelay(unsigned int tick) { unsigned int start, current; start = HWREG(DWT_BASE + DWT_O_CYCCNT); do { current = HWREG(DWT_BASE + DWT_O_CYCCNT); } while((current-start)<tick); } /*********************************************************/ Enjoy!
    L
  4. Like
    Lyon got a reaction from 32614_1489253935 in can not debug   
    Hi,
    First of all, your JTAG pins must have a pull-up resistors mounted on-board.
    Second, if you use your Lauchpad board as debug-out ( to debug another board) then you must disable your LP target micro ( the test/target micro from LP board, the debug one should be active). You can do that by short-circuit of reset capacitor on LP board.
    L
  5. Like
    Lyon got a reaction from 32614_1489253935 in using ADC tivalaunchpad   
    Hi,
    At the motobike battery voltage, the ADC offset mostly does not matter, or is within a good accuracy. It can be measured and used into a formula to get better results, but at the expense of some external components. More, you must scale down the voltage to be within the ADC range, (the maximum scaled battery voltage should be less than maximum ADC range) and the scaling is better to be done with resistors and an op-amp, since the ADC input impedance is not so high.
    TI has all sort of components to make measurements, including temperature sensors. Choose whatever is convenient to you. I prefer ones giving scaled results (degC/mV inmy case) since I only measure the voltage without too much calculations.
    L
  6. Like
    Lyon got a reaction from dpharris in make a circuit with H6PM sample   
    Hi,
    First this one: http://www.ti.com/lit/an/spma059/spma059.pdf
    The second, Launchpad board manual, hope you have it.
    One word of caution: you say:
    "can use all function as a Tiva Launchpad without JTAG."
    but design the board with JTAG connector, otherwise you are lost...
    L
  7. Like
    Lyon got a reaction from 32614_1489253935 in make a circuit with H6PM sample   
    Hi,
    First this one: http://www.ti.com/lit/an/spma059/spma059.pdf
    The second, Launchpad board manual, hope you have it.
    One word of caution: you say:
    "can use all function as a Tiva Launchpad without JTAG."
    but design the board with JTAG connector, otherwise you are lost...
    L
  8. Like
    Lyon got a reaction from spirilis in What is stored at the second word space in _text section?   
    Hi,
    Nothing is wrong, all is perfect as it should be. This is the usual behaviour of Cortex-Mx micros, where the interrupt routines (all, including reset_isr) gets an odd address when placed into interrupt vector routines, for signalling the fact the micro should use thumb(2) instructions, and not original ARM.
    It would be an error to get even address in interrupt vector, and that would lead to interrupt fault.
    L
  9. Like
    Lyon got a reaction from 32614_1489253935 in SSI trouble   
    Hi,
    This is related to Digital Function selection (GPIOPCTL PMCx Bit Field Encoding)- see page 648/Table10-2 (GPIO Pins and Alternate Functions). It is the value to be written into PMCx, x=0..7, corresponding to the pin. L
  10. Like
    Lyon got a reaction from 32614_1489253935 in SSI trouble   
    Hi,
    Unfortunately you forgot to attach the file...
    L
  11. Like
    Lyon got a reaction from igor in assembler listing   
    HI,
    Don't know if there is a command inside Energia - but outside of it you may try:
    arm-none-eabi-objdump -h -S your_file.elf > your_file.lst
    (in Eclipse usually this is realised as post-build step).

  12. Like
    Lyon got a reaction from 32614_1489253935 in WTIMER0 and TIMER0   
    Hi,
    Wtimer is a 64 bit timer, while the usual Timer is only 32 bit timer.
    Now: you ca split a timer in two halfs, but those have a capacity half of the "name": for a WTimer, WTimer0A is 32 bits wide, while for usual Timer, Timer0A is 16 bits wide. Similar for WTimer0B vs. Timer0B.
     
    L
  13. Like
    Lyon got a reaction from colotron in Toolchain setup under GNU/Linux (including Eclipse)   
    Hi,
    Just read your blog and noticed you used gnuarmeclise site only for info, not installing, not taking any benefit of this package: templates for micros,   newlib use, managed make, detailed settings, bin file generation for Tiva, so on.
    Also, useful for users is the EmbeddedRegisterView package, allow to see content of peripheral registers by names, not searching in memory vies by addresses.

  14. Like
    Lyon got a reaction from cry_viem in QEI module   
    Hi,
    Your guess is correct - lm4f120h5qr (re-named TM4C1233H6PM) does not have QEI module.
    L
  15. Like
    Lyon got a reaction from L.R.A in Any links for CCS tutorials?   
    Hi,
    The main problem(s) with any tools are the path managing - and this depends also on operating system - so first knowledge should come from there.
    As many users have problems with that, TI has this page showing the CCS specific, here:
    http://processors.wiki.ti.com/index.php/Include_paths_and_options
    Some particular settings will remain - for Tiva is better to import a good working program, like any qs_xxxx applications, and knowing where to look from previous link, inspect the program settings and write down specifics for further use.
     
    Also there are some tutorials - may be found on Tiva forum, searching a little bit.
     
    As for other compiler, I use this one: https://launchpad.net/gcc-arm-embedded with Eclipse. This is made by volunteers from Keil, and there are a number of good things (nano-lib). If you decide for try of this, add also this: http://gnuarmeclipse.livius.net/blog/plugins-install/ - this one make the Eclipse in a full IDE, just need to add also OpenOCD. (works on Linux and OSX)
    L
  16. Like
    Lyon got a reaction from L.R.A in TM4C129 Hibernation RTC and Calendar Mode   
    Hi,
    The "calendar mode" is a feature available only for TM4C129x microcontrollers. Does not exist on 123 series. It is an addition of several registers with bit fields allocated for year, months, day of the week, hours, minutes, seconds.
    On "old" Launchpad you will get hard fault, since calendar mode writes to non-existing registers (of coarse you need to initialize with some data before calling HibernateCalendarGet() ).
    However, the RTC counter mode is still available, can be used - and that implies of coarse the transformations with time structure, instead to be read at once.
    L
  17. Like
    Lyon got a reaction from bluehash in TM4C1294 Bricked   
    HI,
    Your micro may be locked and you can unlock it with the use of UNIFLASH application, Linux version from this link:
    http://processors.wiki.ti.com/index.php/Category:CCS_UniFlash
    L
  18. Like
    Lyon reacted to Pradeepa in GPIO Interrupt Question   
    @@Sahil @@lawrence_jeff,
     
    Recently I saw this post.
     
    Interrupt enabling was never hard for me. So I decided to give some time to figure out what the actual issue in your first code. I think you need to refer the User Guide of the API after going through the introductory lab sessions to get somewhat clearer view on these APIs.
     
    Under NVIC it is specifically mentioned,
     
     
    But in your code you have not done that. You have not enabled interrupts for PORTC.
     
    The workaround proposed works because within the "GPIOPortIntRegister" function internally it calls IntEnable() function. 
     
    My working code looks like below,
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); GPIOPinTypeGPIOInput(GPIO_PORTC_BASE,GPIO_PIN_6); GPIOPadConfigSet(GPIO_PORTC_BASE,GPIO_PIN_6,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU); GPIOIntTypeSet(GPIO_PORTC_BASE, GPIO_PIN_6,GPIO_FALLING_EDGE); GPIOPinIntEnable(GPIO_PORTC_BASE, GPIO_PIN_6); GPIOPinIntClear(GPIO_PORTC_BASE, GPIO_PIN_6); IntMasterEnable(); IntEnable(INT_GPIOC); In addition to this code, I included the interrupt handler in the NVIC under 'GPIO port C' and referred to the handler as an 'extern function'. I think you know about that process.
     
    The difference between the 'workaround' and this method is that when you use "GPIOPortIntRegister" it will dynamically register the Interrupt handler. So the interrupt handler address will be stored in the SRAM. When the processor is actually catering to the interrupt it will have to fetch this address from the SRAM, which will add some latency to the code. 
     
    But if you statically register the interrupt handler through the NVIC, then your flash will contain the required address and the processor do not need to fetch the address from the SRAM. Which will be fast.
     
    If we can save some more clock cycles, it is always better to use that method  if the requirement permits you to do so. It will improve performance and save some power.
     
    Thank you.
  19. Like
    Lyon got a reaction from cry_viem in gpio   
    Hi,
    PF0 is the NMI pin (also PD7) so you must to unlock it first before using it.
    See how to here: http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/284566.aspx
    L
  20. Like
    Lyon got a reaction from bluehash in gpio   
    Hi,
    PF0 is the NMI pin (also PD7) so you must to unlock it first before using it.
    See how to here: http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/284566.aspx
    L
  21. Like
    Lyon got a reaction from robomon in How to send 1MSPS 12bit ADC samples via USB FS   
    Hi,
    But take into account you do not need too many samples to take - depending on your viewport, 100 points (samples) may be enough. You cannot compress pixels/points - this is usual the limit of eye resolution (although you may protest to this assertion…) and while you transmit a buffer with 100 samples, another one is to be acquired, so some hardware/software parallel processing. 
     
    Tektronix used (at the beginning of DSO era) to take such amount of samples and then to interpolate between points to give some extra resolution. This was until someone developed the 1Gs/s sampler and this is the stage today (interpolation was with problems, many people unhappy with waveform displayed). 
    L
  22. Like
    Lyon got a reaction from bluehash in How to send 1MSPS 12bit ADC samples via USB FS   
    Hi,
    Please see this package: http://www.ti.com/tool/sw-ek-lm3s3748 has a nice oscilloscope implementation, with USB. Maybe not the fastest in the world, but could be a good starting point for improving. Full code available, drivers...
    L
  23. Like
    Lyon got a reaction from M-atthias in Discovered TM4C1294 ADC silicon bug ?   
    Hi,
    The main problem with 129 series when migrating software is system clock setting, which changed a lot - new options for PLL settings at 320/480MHz - so check the system settings clock and to be sure it works correctly. But as no inside is available for measuring frequency, the best idea is to use either UART and see if working OK or a PWM generating a prescribed waveform.
    Also you can check the Tiva software, code is open. The example program qs-iot uses ADC, sample sequencer 3 to measure temperature.
    L
  24. Like
    Lyon got a reaction from M-atthias in Discovered TM4C1294 ADC silicon bug ?   
    Hi,
    ADC clock must be configured also (new in Tiva-129!) with the call: ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC | ADC_CLOCK_RATE_FULL, 1);   And this one can be read (from driverlib/adc.c) as (neglecting first some assertions):     //     // Write the sample conversion rate.     //     HWREG(ui32Base + ADC_O_PC) = (ui32Config >> 4) & ADC_PC_SR_M;       //     // Write the clock select and divider.     //     HWREG(ui32Base + ADC_O_CC) = (ui32Config & ADC_CC_CS_M) |                                  (((ui32ClockDiv - 1) << ADC_CC_CLKDIV_S)) ;   As you can see, all these are based on HWREG macro, defined in inc/hw_types.h as: #define HWREG(x)             (*((volatile uint32_t *)(x))) which I assume you know it. You may verify these and get additional code for your case. If you pre-process the above snippet, you will have an instant conversion of all constants or you can transform them into direct register access. L
  25. Like
    Lyon got a reaction from M-atthias in Discovered TM4C1294 ADC silicon bug ?   
    Hi,
    Please be careful - the excerpt in blue is part of the function mentioned above - you do not need to repeat again. I was trying to suggest you to read the code in driverlib, to see it is easy to decipher and then use.
    Now, I suggest again to read the comments of that function in driverlib. I recognize the user manual is/has some problems, but the main descriptions are in the followings:
    -paragraph 18.3.2.6 - Module clocking
    -paragraph 5.2.5.2 - page 247 ADC Clock Control
    But I use what is written in driverlib - used in several other situations without problems.
    L
×
×
  • Create New...