-
Content Count
599 -
Joined
-
Last visited
-
Days Won
12
Reputation Activity
-
L.R.A got a reaction from RROMANO001 in Energia MT / TI-RTOS support for other boards
I think the next board in line is the CC3200 actually, let's see how long it takes.
If you want TI RTOS they are already supported but of course Energia MT is much easier to use
-
L.R.A got a reaction from Fred in New toys on June 10th!
There's already a post about the rumor and I'm just here to tease a bit
A new ARM toy is coming June 10th. Not only a new board but a new part.
Be on the lookout!
-
L.R.A got a reaction from pine in New toys on June 10th!
There's already a post about the rumor and I'm just here to tease a bit
A new ARM toy is coming June 10th. Not only a new board but a new part.
Be on the lookout!
-
L.R.A got a reaction from stirlingboy in [TM4C1294NCPDT] 8 pins Blinky with DMA
Hello everyone,
Today i have a code to show a simple fuction of the DMA for the TM4C1294
This just blinks 8 outputs every second using a Timer in periodic mode and a trigger with the timeout.
I hope it helps anyone trying to get basic understanding of the DMA
void TimerInt(void); void InituDMA(void); void InitGPIO(void); void InitTimer(void); void setup(); void loop(void); #include <stdint.h> #include <stdbool.h> #include "stdlib.h" #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_uart.h" #include "inc/hw_gpio.h" #include "inc/hw_types.h" #include "driverlib/interrupt.c" #include "driverlib/sysctl.c" #include "driverlib/timer.c" #include "driverlib/udma.c" #include "driverlib/gpio.c" #include "driverlib/interrupt.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "driverlib/udma.h" #include <string.h> /* Here you can define what GPIO output you want to use */ #define GPIO_BASE_OUTPUT1 GPIO_PORTN_BASE #define GPIO_PERIPH_OUTPUT1 SYSCTL_PERIPH_GPION //Saves the system clk volatile uint32_t g_ui32SysClock; //Array to save the GPIO states static uint8_t OutputState[2]; //***************************************************************************** // // The control table used by the uDMA controller. This table must be aligned // to a 1024 byte boundary. // //***************************************************************************** #if defined(ewarm) #pragma data_alignment=1024 uint8_t DMAcontroltable[1024]; #elif defined(ccs) #pragma DATA_ALIGN(DMAcontroltable, 1024) uint8_t DMAcontroltable[1024]; #else uint8_t DMAcontroltable[1024] __attribute__ ((aligned(1024))); #endif /* After 2 transfers the DMA is done and calls this interrupt This is to reset the DMA and re-enable it */ void TimerInt(void) { TimerIntClear(TIMER3_BASE,TIMER_TIMA_DMA); //Set again the same source address and destination uDMAChannelTransferSet(UDMA_CH2_TIMER3A | UDMA_PRI_SELECT, UDMA_MODE_BASIC, OutputState, (void *)(GPIO_BASE_OUTPUT1 + 0x3FC), 2); //Always needed since after it's done the DMA is disabled when in basic mode uDMAChannelEnable(UDMA_CH2_TIMER3A); } /* Function to setup the DMA */ void InituDMA() { //Just disable to be able to reset the peripheral state SysCtlPeripheralDisable(SYSCTL_PERIPH_UDMA); SysCtlPeripheralReset(SYSCTL_PERIPH_UDMA); SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); SysCtlDelay(10); uDMAEnable(); uDMAControlBaseSet(DMAcontroltable); /* * This is for seting up the GPIO_BASE_OUTPUT1 with CH2 TimerA */ //Set the channel trigger to be Timer3A uDMAChannelAssign(UDMA_CH2_TIMER3A); //Disable all the atributes in case any was set uDMAChannelAttributeDisable(UDMA_CH2_TIMER3A, UDMA_ATTR_ALTSELECT | UDMA_ATTR_USEBURST | UDMA_ATTR_HIGH_PRIORITY | UDMA_ATTR_REQMASK); /* This sets up the item size to 8bits, source increment to 8bits and destination increment to none and arbitration size to 1 */ uDMAChannelControlSet(UDMA_CH2_TIMER3A | UDMA_PRI_SELECT, UDMA_SIZE_8 | UDMA_SRC_INC_8 | UDMA_DST_INC_NONE | UDMA_ARB_1); /* This will setup the transfer mode to basic, source address to the array we want and destination address to the GPIO state we chosed. It also sets the total transfer size to 2. */ uDMAChannelTransferSet(UDMA_CH2_TIMER3A | UDMA_PRI_SELECT, UDMA_MODE_BASIC, OutputState, (void *)(GPIO_BASE_OUTPUT1 + 0x3FC), 2); //Enable the DMA chanel uDMAChannelEnable(UDMA_CH2_TIMER3A); } /* This is to set all the pins of the GPIO chosen to output */ void InitGPIO() { SysCtlPeripheralDisable(GPIO_PERIPH_OUTPUT1); SysCtlPeripheralReset(GPIO_PERIPH_OUTPUT1); SysCtlPeripheralEnable(GPIO_PERIPH_OUTPUT1); SysCtlDelay(10); GPIOPinTypeGPIOOutput(GPIO_BASE_OUTPUT1, 0xFF); GPIOPinWrite(GPIO_BASE_OUTPUT1,0xFF,0x0); } /* Function to setup the timer to count down periodic with 1 second period. It also enables the DMA trigger and the event to timeout (counter reach 0) */ void InitTimer() { SysCtlPeripheralDisable(SYSCTL_PERIPH_TIMER3); SysCtlPeripheralReset(SYSCTL_PERIPH_TIMER3); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER3); SysCtlDelay(10); TimerConfigure(TIMER3_BASE, TIMER_CFG_PERIODIC); TimerLoadSet(TIMER3_BASE, TIMER_A, 120000000-1); TimerIntClear(TIMER3_BASE,TIMER_TIMA_DMA); TimerIntRegister(TIMER3_BASE,TIMER_A,TimerInt); TimerIntEnable(TIMER3_BASE,TIMER_TIMA_DMA); TimerDMAEventSet(TIMER3_BASE,TIMER_DMA_TIMEOUT_A); } void main() { //Set CLK to 120Mhz g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); InitTimer(); InitGPIO(); InituDMA(); /* Sets the pins state all to 0 first and all to 1 in second. You can control individual pins in each bit of each array member. You can make the array bigger if you want but remember to set the DMA total transfer size too */ OutputState[0]=0x00; OutputState[1]=0xFF; //Enable the timer to start counting TimerEnable(TIMER3_BASE,TIMER_A); //Infinite loop and just watch the pins toggle while(1){ } }
-
L.R.A got a reaction from stirlingboy in [TM4C1294NCPDT] 8 pins Blinky with DMA
Btw I have a little tutorial about the DMA here:
https://sites.google.com/site/luiselectronicprojects/tutorials/tiva-tutorials/tiva-dma
I posted the code here but never the tutorial
-
L.R.A got a reaction from abecedarian in MSP432 Timer32 use
Checked the datasheet and they are very similar to Tiva timers. Didn't check the reference manual for further details.
They are 32bit timers which can be split each one into two 16bit timers. My guess is they have signals (PWM, capture, etc) but only when used in split timer mode. In 32bit mode they can be used in periodic mode at least (could also have one-shot mode and other modes that don't require a signal).
That's my bet
-
L.R.A got a reaction from abecedarian in Software PWM vs. Servo Library
If I am not mistaken the servo library does use software PWM.
You could make hardware PWM though I am not sure it would be able to get down to 50Hz at full clock speed (at 16Mhz), I am not familiar with the MSP430 timers. Give it a try, as abecedarian said, the board has plenty of PWM outputs.
-
L.R.A got a reaction from amine in How to change system clock frequency of tiva c launchpad using PLL on energia?
Hi Amine,
I don't think there is a way to do that with Energia libraries. You have to use TivaWare libraries.
For that you need to include:
#include <stdint.h> #include <stdbool.h> #include "driverlib/pin_map.h" #include "driverlib/sysctl.c" and I think I am not missing anything (I don't usually use the compiler that Energia uses).
Then this depends on which launchpad you have. Is it the smaller one? If it is just use:
SysCtlClockSet(). As an example for 80Mhz clock with the PLL, main oscillator with external 16Mhz crystal:
SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ); For more info check this out:
https://sites.google.com/site/luiselectronicprojects/tutorials/tiva-tutorials/tm4c123-clock
-
L.R.A got a reaction from abecedarian in New Hercules LP's in bound
I heard it can be twice as powerful as their predecessors. *hides*
-
L.R.A reacted to spirilis in How exactly Energia MT handles single threads?
It currently has no way to "not" run as an RTOS to my knowledge, so I believe delays will yield to the RTOS kernel.
Sent from my Note 10.1 tablet using Tapatalk
-
L.R.A got a reaction from PTB in Stellaris fast analog reads
Went ahead and check my Tivaware version, the latest, and there isn't a SysCtlADCSpeedSet() function!
I really don't know what is the idea with the second register it changes:
HWREG(SYSCTL_SCGC0) = ((HWREG(SYSCTL_SCGC0) & ~(SYSCTL_SCGC0_ADCSPD_M)) | ui32Speed);
It's setting to 0 a reserved area, somehow it must be "leaking" into bits 16 and 17 of that register. Either way, avoid using that function. Instead use for ADC0:
HWREG(SYSCTL_RCGC0) &= ~SYSCTL_RCGC0_ADC0SPD_M; // change if you want ADC1 HWREG(SYSCTL_RCGC0) |= SYSCTL_RCGC0_ADC0SPD_1M; // change for the desired speed with the macros and the ADC module -
L.R.A got a reaction from PTB in Stellaris fast analog reads
Hum weird.
Basically you are directly changing the register values. I usually don't do register programming but sometimes it's needed.
For some reason setting the ADC speed that way causes problems. If you remove that line I told you to add the code should run. The register I said to change is a legacy register, there's actually a better, new way to set the ADC rate.
I really can't find a Tivaware function to set the max sample rate . So I can't really give you a solution without using HWREG. Try what's bellow, right now I can't test it out.
It seems the right register to change, that isn't legacy, is: Register 55: ADC Peripheral Properties (ADCPP), offset 0xFC0
HWREG(ADC0_BASE+0xFC0) &= ~0xF;
HWREG(ADC0_BASE+0xFC0) |= 0x7;
-
L.R.A reacted to bluehash in $10 2.4" Color LCD Nextion: a cost-effective high-performance TFT HM
On Indiegogo. I got the $10 one. Worth a try for that price. 260 remaining when I ordered mine.
Nextion: a cost-effective high-performance TFT HMI
-
L.R.A got a reaction from bluehash in local variable writes over other variable?
Hi everyone,
So I'm facing a problem I simply can't solve so far.
So I'm trying to make some C drivers kinda like Tivaware.
My problems is that local variables in main.c (a array of 100 chars) are writing over global variables in library.c
Am I being stupid or something? How can I avoid this?
Edit: Derp, it was the stack size defined on the compiler
-
L.R.A reacted to bluehash in CCS linker configuration file
Yes.. the CC3200 does not have flash. It loads code into SRAM from an external flash chip at boot.
-
L.R.A got a reaction from MSPLife in CCS linker configuration file
It seems you have Code in your RAM.
So SRAM_CODE should be the code you have in the RAM while SRA_DATA is the memory used for variables. You got that from the .MAP?
-
L.R.A got a reaction from bluehash in [TM4C1294NCPDT] 8 pins Blinky with DMA
Btw I have a little tutorial about the DMA here:
https://sites.google.com/site/luiselectronicprojects/tutorials/tiva-tutorials/tiva-dma
I posted the code here but never the tutorial
-
L.R.A reacted to tripwire in Tiva/CC3200 DMA performance information?
I'm happy to post the code to show how I got the results, but be warned: it ain't pretty!
I used direct register access instead of driverlib so I could keep things consistent with the MSP430 version. Also the test setup doesn't use interrupts directly related to the DMA operation. Instead it wakes up when the timer module measuring the DMA transfer captures the falling edge of its input.
For those reasons it's a pretty bad example of how to write DMA code on CC3200. This post is probably a better place to look for that.
Anyway, enough excuses, here it is:
DMATest.c
(Does anyone get the feeling TI deliberately made direct register access unpleasant on CC3200 to "encourage" everyone to use DriverLib?)
-
L.R.A got a reaction from pramod97 in Tutorials+Codes for Tiva
Hey everyone, if you are beginning to program with Tiva or already program but just with Energia check out my blog. And to those that already work with Tiva, please give me some advise
Discussion here in Stelarisiti: http://forum.stellarisiti.com/topic/2126-tutorialscodes-in-tivaware/
-
L.R.A got a reaction from luligar in Noob question: enabling interrupts with TivaWare APIs?
Fun fact:
If you do GPIOIntRegister (or other PeripheralIntRegister I belive) it also does
// // Enable the GPIO interrupt. // IntEnable(ui32Int);
So it actually enables the interrupt
I always used GPIOIntRegister instead of default handlers and saw other codes using the IntEnable. But I never needed and didn't know why
This is why -
L.R.A reacted to Desmond in Stellaris as a tool
The best example of Stellaris as a tool is as a logic analyzer see here.. http://www.sodnpoo.com/posts.xml/variable_sample_rate_stellaris_logic_analyser.xml
Currently I am working with the ESP8266 modules and I wanted to see what was being transmitted and received over the serial interface without cluttering my code with debug.
Stellaris is perfect.
-
L.R.A got a reaction from abecedarian in Valid values for pfnIntHandler?
Check the rest if you are starting
I made them who is starting programming with Tiva. I have some updates I want to make but the time isn't enough for that.
Trying to get what's already there and adding more that's it's missing (like a more dedicated part to interrupts programming basis) more organized in a workshop stile.
-
L.R.A reacted to abecedarian in Can somobody give an ideea how to rezolve this error ? I'm trying to use the pushbuttons to blink a led . Thx
So, why using StellarisWare instead of TivaWare?
-
L.R.A reacted to Remixed123 in Code: iOS Starter App To Control CC3200 LaunchPad LEDs
Hi Everyone,
I have put together an example iOS App that controls the CC3200 LaunchPad's LEDs using UDP packets.
Features
Control the CC3200 LaunchPad's Red or Orange LED by pressing ON or OFF within the App Press a button to open a browser which loads the CC3200 LaunchPad's internal web server configuration pages Press a button to open the Github repository Code Access
The code is stored on my Github account here - https://github.com/remixed123
There are two repositories you will need:-
startproject_ios - this is the repository with the Objective C code ready to work with Xcode and an iOS device or the emulator startproject_cc3200_ti-rtos - this is the repository with the C code ready to work with Code Composure Studio and the CC3200LaunchPad (This is also great starter code for any project that is using Ti-RTOS) iOS App
And here is what the app looks like.....nice and simple.
Please let me know if you find any bugs, and also feel free to push any updates to the respective repositories.
Glenn.
----------------
Code Examples:
End to End IoT Proof of Concept Using Microsoft Azure and CC3200: http://ssmlwf.azurewebsites.net/ iOS App that controls CC3200 LEDs using UDP: https://github.com/remixed123/startproject_ios CC3200 Starter Code for TI-RTOS: https://github.com/remixed123/startproject_cc3200_ti-rtos -
L.R.A got a reaction from 32614_1489253935 in encoder interface
As i said, the TM4C123G launchpad tolerates 5V input voltages.
If you still need to convert:
Just use a voltage divider https://www.abelectronics.co.uk/docs/tools/resistor/voltage-divider.gif
It's simple. Just remember to take current into account, not to little nor too much. This basically turns a scale of 0V-5V to a scale 0V-3.3V
Other way for digital signals is this one: http://repetae.net/zenerresistor.png
You could always use 1 mosfet per data line, but that should not be necessary, since it's not a bi-directional signal. http://i.stack.imgur.com/64Dk9.png
You can read this too http://www.ti.com/lit/an/slaa148/slaa148.pdf
All of this can easily be found in google images by just typing "5V to 3.3V"
The encoder outputs a PWM signal. Just that. You should not have problems with any of the methods if applied correctly. Ex: if the enconder outputs a high frequency you can't use resistors to big like 1M which would mean a really low current, but try to keep about 2mA max input into you MCU pins