# timotet

Members

223

1

## Reputation Activity

1. timotet got a reaction from Rickta59 in Stellaris Launchpad Reprap
This is awesome!
I would like to see the other board.
2. timotet reacted to oPossum in Fast itoa() for CCS
itoa() is not part of the standard C library and is absent from CCS.

Here are three functions to convert signed and unsigned integers to ASCII. They are written for speed, not compactness.

void itoa(int, char *); // Convert signed integer to ASCII
void utoa(unsigned, char *); // Convert unsigned integer to ASCII
void btoa(unsigned, char *); // Convert unsigned char to ASCII (leading spaces)

itoa() and utoa()

btoa()

btoa ; --- Byte to ASCII --- ; - Range 0 to 255 ; - Leading zeros converted to spaces clr R14 ; Clear packed BCD swpb R12 ; Move LSB to MSB .loop 8 ; Do 8 bits rla R12 ; Get a bit of binary dadd R14, R14 ; Multiply BCD by 2 and add binary bit .endloop ; ; mov R14, R12 ; Copy packed BCD digits and #0x0F0F, R12 ; Mask digits 1 & 3 mov #('0' << 8) | '0', R15 ; Make ASCII add R15, R12 ; mov.b R12, 2(R13) ; Move digit 3 to bcd[2] swpb R12 ; Swap digits 1 & 3 mov.b R12, 0(R13) ; Move digit 1 to bcd[0] rra R14 ; Shift digit 2 to lower nibble rra R14 ; rra R14 ; rra R14 ; and #0x0F0F, R14 ; Mask digit 2 add R15, R14 ; Make ASCII mov.b R14, 1(R13) ; Move digit 2 to bcd[1] clr.b 3(R13) ; NULL terminate string cmp.b R15, 0(R13) ; Is first digit a 0? jne b2aex ; No... cmp.b R15, 1(R13) ; Is second digit a 0? jne b2a2d ; No, only the first.. mov #(' ' << 8) | ' ', 0(R13); Make first two digits spaces reta ; Return b2a2d ; mov.b #' ', 0(R13) ; Make first digit a space b2aex ; reta ; Return
itoa.zip
3. timotet got a reaction from msptest6 in Hardware SPI working with the Nokia 5110 LCD
I got hardware SPI working with the Nokia 5110 LCD.
I used a GPIO for the chip enable, and an interrupt for bringing CE high after transmission.
I've attached the code below and a small graphics library that I put together from various sources on the web.

One thing I found confusing was there seems to be no interrupt flag set when the SPITXBUF empties.
So in the situation like this one where the Rx of the SPI is not even being used, to get the interrupt to work
you still use the Rx ISR.

Here is my interpretation: Write data to SPITXBUF data shifts through SPIDAT and is transmitted out SPISIMO,
simultaneously the same data is shifted into SPIRXBUF and SPI INT FLAG is set. Then you use the Rx ISR to read
the SPIRXBUF and that clears the SPI INT FLAG.

Is this correct?
Also the documentation on the FIFO is somewhat vague for the inexperienced.
How would I go about using the FIFO for this example?

Here is a short video:

thanks
Tim
C2000_nokia5110.zip
4. timotet got a reaction from cubeberg in [S]IV-18 VFD Clock Booster Pack
MAN! that is sweet nice work cube!!!!
5. timotet reacted to TI_Trey in SOLVED: SPI on C2000 launchpad
Replace your common directory with this
Import the driverlib project from this directory
Build the driverlib project
Rebuild the SPI example with the code posted above

The example should work now.
f2802x_common.zip
6. timotet reacted to TI_Trey in SOLVED: SPI on C2000 launchpad
CorB,

I solved the issues with the original example. It turns out the order in which the FIFO register bit fields are configured is important. To the best of my knowledge this isn't documented in the user guide for the SPI peripheral. If you replace the initialization code with the following code you should see the example start working. I'm glad you were able to get the LCD working and I think a good next step would be to try to get the LCD working using the actual SPI peripheral.

Cheers!

void spi_init() { SPI_reset(mySpi); SPI_enable(mySpi); // Reset on, rising edge, 16-bit char bits SPI_setCharLength(mySpi, SPI_CharLength_16_Bits); SPI_enableLoopBack(mySpi); // Enable master mode, normal phase, // enable talk, and SPI int disabled. SPI_setMode(mySpi, SPI_Mode_Master); SPI_enableTx(mySpi); SPI_enableOverRunInt(mySpi); SPI_enableInt(mySpi); SPI_setBaudRate(mySpi, (SPI_BaudRate_e)0x63); // // Initialize SPI FIFO registers SPI_enableFifoEnh(mySpi); SPI_enableChannels(mySpi); SPI_resetTxFifo(mySpi); SPI_clearTxFifoInt(mySpi); SPI_setTxFifoIntLevel(mySpi, SPI_FifoLevel_2_Words); SPI_enableTxFifoInt(mySpi); SPI_resetRxFifo(mySpi); SPI_setRxFifoIntLevel(mySpi, SPI_FifoLevel_2_Words); SPI_enableRxFifoInt(mySpi); SPI_clearRxFifoInt(mySpi); SPI_setTxDelay(mySpi, 0); // Set so breakpoints don't disturb xmission SPI_setPriority(mySpi, SPI_Priority_FreeRun); SPI_enable(mySpi); SPI_enableTxFifo(mySpi); SPI_enableRxFifo(mySpi); }

EDIT: Crap! I forgot I changed a few things in driverlib. I'll upload a new version of that as well. Look for a real controlSUITE release later this week/next week.
7.
INV15OFF
8. timotet reacted to CorB in How to use an ADCpin for GPIO ?
Hi,

In the code below I have created 2 functions InputPin and OutputPin that can be used to set a GPIO (and soon ADC)-pin to be used as either input or output. You can use either the predefined GPIO_number setup or MSP430 pins or C2kPins as a name.
So
InputPin(GPIO_Number_12) //button
InputPin(J2_3)
InputPin(P2_7)
all set the same pin as an inputpin.

Surely not perfect and I am also working on getting the ADCpins to be controlled in the same simple fashion.

cheers
Cor
PS. It seems that we cannot use all the ADCpins as GPIO (see page 89 in http://www.ti.com/li...3c/sprufn3c.pdf), the AIOMux1 register only allows AIO2/4/6/10/12/14 to be used as GPIO. This corresponds to ADCINA2, ADCINA4,ADCINA6, ADCINB2, ADCINB4, ADCINB6 on the launchpad.These are the ADCpins on J1 and J2 (or P1 and P2) so they can also be used with MSP430 Boosterpacks

.... code removed ... see later message #15
9. timotet reacted to CorB in How to use an ADCpin for GPIO ?
Here's the list of all pins with corresponding GPIO and ADCnames, I am using this as a reference but will try to create a function that allows easy and simple setting of all the GPIO pins. I am now also going for a naming style that is equal to the pinnumber/name on the launchpad, so J1 and J2 (outer pingroups) and J5 / J6 for the inner pingroups.

.... code removed see final coding in later message #15
10. timotet reacted to oPossum in 6 channel logic analyzer
The LogicBoost is a 6 channel 16 MHz 256 ksample logic anlyzer booster for the MSP430 launchpad. It works with 3 to 5 volt logic levels.

Many common communication protocols can be observed, such as:
- Async serial ("UART", "RS-232")
- SPI
- IIC
- Dallas/Maxim one wire
- Low speed USB (1.5 Mbps)
- DHT11/22 sensors
- Consumer infrared and IRDA
It is also useful for PWM and other applications.

SPI RAM chips are used for the acquisition buffer. This greatly simplifies the design relative to using parallel SRAM chips. The SPI RAM have and internal address counter that eliminates the need for an external address bus and counter. The MSP430 sets up an address and write mode, and then data is clocked into the RAM on every SPI clock.

The PCB is 50 x 50 mm for low cost and uses thru-hole components so anyone can build it. An optional FTDI board can be used for faster host communication.

It can be stacked with the Launchpad Mini - also 50 x 50 mm. An FTDI board is required for host communication and power in this configuration.

11. timotet reacted to xpg in Mailbox Notifier
The mailbox notifier is a simple system, which notifies about new mail in the physical mailbox. It consists of two parts: The transmitter and the receiver. The two components talk to each other using a 433MHz wireless protocol.
The transmitter sits in the mailbox and detects if the mailbox

12. timotet reacted to spirilis in TI boost converter - TPS61221
Thought I'd share some thoughts on this chip since it's an obvious choice for powering low-power MSP430 type apps off a battery in some remote location.

The TI TPS6122x series are boost converter chips, i.e. you have to add capacitors and an inductor around it, which take a battery voltage from 0.7V-5.5V and boost it to the appropriate output -- 61220 is an adjustable model where you build a resistor network on the Feedback line to specify the voltage, 61221 is fixed to 3.3V, 61222 is fixed to 5.0V. Peak output is technically 200mA although you should keep it lower than that, maybe 120mA or lower to account for performance while the battery drains down.

TI's product page: http://www.ti.com/product/tps61221

The chip is tiny and only comes in surface-mount packages, the DCK package (0.65mm pitch, 6-pins). The pitch of the pins is similar to the pitch of the surface-mount MSP430 TSSOP packages, at least for the value line. Definitely DIY'able although I'd suggest soldering the TPS61221 chip first (so you have clear access to all the pins without other junk getting in the way of your iron) before you solder the rest of the components.

Anyway I've made 2 test boards (single-sided toner-transfer PCBs) to measure the actual characteristics of the chip. I've mainly only measured its current draw from the battery under no-load conditions, but I've confirmed it can power an LED (blue) drawing about 35mA with no limiting resistor. (The battery input side was showing weird results, about 220mA, which I suspect has to do with the 200mA switching current it uses to do its work... I'd probably need an oscilloscope to properly measure what's going on there. It's supposed to draw what it needs + 5.5uA in terms of net current draw, but does so using periodic/frequent 200-400mA swings in current across the inductor)

At zero load, my multimeter's uA range shows about 9-10uA draw from the battery, just about what the datasheet suggests. My first experimental board I used some Tantalum capacitors I had and I think they were a mistake; no-load power draw ranged from 400uA-3mA with those. I've had similar problems with them in past boards where they'd short circuit causing upwards to 1A draw off the power supply, so I have since thrown them away and stuck with ceramics instead. Using a 10uF ceramic cap on the input side (+Vbatt to GND), and a 1uF (close to the chip) + 10uF ceramic cap on the output side (Vout to GND) it behaves like the datasheet suggests. FWIW, I used a 4.7uH SMD inductor rated up to 650mA.

The datasheet mentions that if you switch the EN (enable) line off, to GND, it lets battery voltage pass through the onboard MOSFET's bypass diode. This seems to be the case, but it does net a ~0.3-0.5V voltage drop between Vbatt+ and what you see on Vout under those circumstances. Additionally, I noticed a ~10-11uA current draw from the battery with that EN line grounded. Seems like it's pointless to design a circuit where an MCU can shut off the boost converter (say, to save power while the MCU runs off the direct battery voltage bleeding through the boost converter)--because the voltage is dropped a bit and it's still sipping power anyhow. The boost converter OTOH can give the MSP430 a usable voltage until the battery's voltage is around 0.7V (and then, as I saw with a CR2032 + several LEDs toasting the thing, it still outputs some ~1.8V even with the battery run down to 0.4V)

Anyway that's my 2 cents on this chip. I'm going to use it in a design I'm coming up with (uses thermocouple amplifiers that require 3.0-3.6V), more on that later.

PS- Leaving the EN line floating doesn't sound like a good idea, my cheap 10uF ceramic caps seem to make noise (ceramic piezoelectric effect?) when a lot of switching is going on and while I hear it sometimes under normal operation with load (like that blue LED), they go bonkers and the LED flickers like crazy with the jumper removed from the EN line altogether (not GND'ing it). Guessing that destabilizes the switcher.
13. timotet reacted to dkedr in 3-axis stepper driver
Here is the updated design

3 stepper drivers (drv8825/24)
3 i/o port expanders(PFC8574) to control every thing that the steppers do. STEP and DIR is still done directly my the MCU. All INT pins ORed together to detect FAULT. The MCU will have to check all the IO expanders to see which stepper driver has a fault.
1 i/o port expander to read the limit switches. The INT output will cause an interrupt in the MCU.

There are still 2 unused pins on the MCU, I'm thinking temperature sensors? More fets? Supply voltage off clamp?
There should also be two unused pins on the io expander which does the limit switches.

14. timotet reacted to dkedr in 3-axis stepper driver
I'll be getting this board made some time this week, here is a current feature list:

3 x DRV8825 micro stepping stepper drivers
Every pin but the HOME is controllable - micro-stepping, decay mode, enable, sleep, reset.
Fault detection multiplexed through the PCF8574 I2C port expander.
Each stepper driver can have a different current limit set as each has it's own pair of current setting resistors.
2 x 20A n-channel fets for whatever you want.
LEDs can be wired up to be controlled by the PCF8574 or to be always on as long as power is applied.
Up to 8 limit switch inputs multiplexed via PCF8574
On board LM317 regulator(chosen due to high input voltage & it's cheap)

Schematic:

Board:

3 Stepper driver.zip
15. timotet reacted to juani_c in Stellaris LaunchPad

Not much info yet, just the price; a \$4.99 kit. :clap:

EDIT1: Found an LCD boosterpack for this board http://www.kentecdisplay.com/uploads/so ... ide_03.pdf

EDIT2: by the name of the boosterpack It looks like there will be one of the LM4F120 Series
http://www.ti.com/mcu/docs/mculuminaryf ... mostrecent
16.
This is software IIC master code in C, and C++ using a class and a template. There is also code/class/template for IIC EEPROM and the INA219 voltage/current monitor.

There are 4 core functions...

init(); // Init GPIO start(); // Start bit stop(); // Stop bit unsigned ex(unsigned); // Data byte & ack exchange

and 3 helper functions that call ex();...

unsigned write(unsigned); // Write a byte & ack, verify unsigned read(); // Read a byte & ack unsigned read_nak(); // Read a byte & nak

Creating an instance of the IIC object is different for each code type:

C: T_IIC iic = { BIT1, BIT0, &P2IN, &P2OUT, &P2DIR }; C++ class: CSWIIC iic(BIT1, BIT0, P2IN, P2OUT, P2DIR); C++ template: CSWIIC iic;

The C functions require that the IIC structure be passed as the first argument. The C++ class and template use the usual class.function notation.

C: iic_start(&iic); a = iic_write(&iic, ; iic_stop(&iic); C++ class or template: iic.start(); a = iic.write(; iic.stop();

This is a disassembly of the start() function for all three versions. The C function and C++ class member function are identical code! The template allows the compiler to do compile time optimization that can not be done with C or C++ class. It is smaller, faster and uses less RAM.

iic.zip
17. timotet got a reaction from pine in Hate mail : Need your input
Dont let it get you down blue the forum is awesome and I think it has been a great success!
10000 + registered is proof of that.

If they want to see and or download files for an awesome project bad enough they will register,
it only takes a minute even if they are a 1 timer.

Maybe after a year or so the inactive accounts should go away.
just a thought.
Keep up the good work.
18. timotet reacted to oPossum in Volt/Amp/Watt meter
This is a simple voltage and current meter that uses the TI INA219 chip. Voltage measurement range is 0 to 26 volts with 4 mV resolution and current measurement range is -4 to +4 amps with 1 mV resolution (when using a 0.01 ohm shunt). The specs are inferior to a pair of quality multimeters, but it is a fraction of the price and shows wattage in addition to voltage and current. The Nokia 5110 display is used so the firmware could be enhanced to do simple graphing. Sending the measurements to a computer could also be done.

Using the INA219 makes for a very simple circuit.

The normal display is three lines with voltage, amperage and wattage.

Pressing the P1.3 switch will show the 6 registers in the INA219 in hex and signed decimal.

The code is written in C++ and uses templates for the LCD, IIC and INA219. Software SPI and IIC is used for maximum portability.
vam.zip
19. timotet got a reaction from GeekDoc in Hate mail : Need your input
Dont let it get you down blue the forum is awesome and I think it has been a great success!
10000 + registered is proof of that.

If they want to see and or download files for an awesome project bad enough they will register,
it only takes a minute even if they are a 1 timer.

Maybe after a year or so the inactive accounts should go away.
just a thought.
Keep up the good work.
20. timotet got a reaction from RobG in Hate mail : Need your input
Dont let it get you down blue the forum is awesome and I think it has been a great success!
10000 + registered is proof of that.

If they want to see and or download files for an awesome project bad enough they will register,
it only takes a minute even if they are a 1 timer.

Maybe after a year or so the inactive accounts should go away.
just a thought.
Keep up the good work.
21. timotet reacted to RobG in Serial SPI memory functions
Here is the set of functions needed to read and write serial SPI memory, SRAM & EEPROM.

EEPROM: Microchip 25AAxxx series
SRAM: Microchip 23Kxxx series

Included are byte and sequence read and write functions (page boundaries must be handled by user.)
Test functions are also included. Additional functions will be added later on.

Those functions can be used with some of my booster packs, like CC2500, Universal Color LCD, and few other.

Test example

// setup SPI pins, which can be shared with other devices // setup memory specific pins P1OUT |= SRAM_CS_PIN + SRAM_HOLD_PIN; P1DIR |= SRAM_CS_PIN + SRAM_HOLD_PIN; P2OUT |= EEPROM_CS_PIN; P2DIR |= EEPROM_CS_PIN; // setup display // run tests drawString(0,0,"Test SRAM:"); drawString(64, 0, (testSRAM() == 'O' ? "Pass" : "Fail")); drawString(0,10,"Test EEPROM:"); drawString(76, 10, (testEEPROM() == 'O' ? "Pass" : "Fail"));

memory.h
memory.c
22. timotet reacted to voodoofish in Data Logger board
I received the datalogger board today and after multiple hw tests to verify that board functioned as expected, I completed the first of 3 test boards. The last test is to verify that the memory chip is recording correctly, and until then I can't say that this board is 100% functional. though the current 80% has me pretty excited. Now I'm waiting for the addon board that is breaks out the datalogging pins plus a couple other pins to a usable 3 pin configuration.

Images included in this set have the button 1 switch which allows for it to be a reset or action button, and the male header pins. The other image shows the board pre switch and header mockup and also conected to the lp which allows me to do the uploading of programs. Very happy so far. Tonight and tomorrow I'll work on getting the memory chip tested as well as doing some initial tests on the data input ports(adc channels)and communications port(hw uart).

23.
I wanted to be able to verify my system clock was configured properly. I found this feature very useful on the msp430 chips. Turns out that the STM32 Cortex M0 chips also support this. Attached is some code that allows you to output your SYSCLK on pin PA.8 for easy verification of your various clock sources.

/** * Cortex M0 - STM32F0 Discovery board code spew out one of the clocks on PA.8 */ void OutputMCO() { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); /* Output clock on MCO pin ---------------------------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOA, &GPIO_InitStructure); // pick one of the clocks to spew RCC_MCOConfig(RCC_MCOSource_SYSCLK); // Put on MCO pin the: System clock selected //RCC_MCOConfig(RCC_MCOSource_HSE); // Put on MCO pin the: freq. of external crystal //RCC_MCOConfig(RCC_MCOSource_PLLCLK_Div2); // Put on MCO pin the: System clock selected }

-rick
24. timotet got a reaction from liter in STM32F4 gdbserver Error in "Initializing ST-Link device "
Some of these may seem like common sense but bear with me.
Are you using a usb hub?
Your machine loaded the drivers for the f4 board when you plugged it in?
It says STM32 STlink when you open devices and printers?
Have you looked around on the ST e2e forum?
I know that there is a STM32 stlink utility you can down load from here:http://www.st.com/in...duct/251168.jsp
The latest usb drivers are there also.
hope it helps
Tim
25.