Jump to content

David Bender

  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by David Bender

  1. I wrote this library to do fancy analysis and collation of intel hex files https://github.com/analog10/ihp If you find it useful please leave a comment in the forum.
  2. I think it would be really cool to have a battery powered ESP8266 that could write to the flash of an MSP430 via the UART BSL. There are 2 free GPIO on the ESP8266 that could toggle the RST and TST lines as well as the normal RX/TX. In operation, one could upload a small file to the ESP8266 via web interface and initiate the transfer via a button on the same. Also once could read/write the information segments as well. Is there any existing project like this or any interest in the community for it?
  3. begin_lcd_write() just buffers data and initializes the TA0.1 IE. The LCD data are clocked in the timer interrupt handler so there really isn't any blocking. I think an improvement would be to supersample 8 times, average and then use the change in value as a determination of how far the encoder turned, rather than only comparing discrete levels.
  4. I had a lack of digital input pins for a pushbutton rotary encoder switch so I used an analog input. I wrote up my results here: https://analog10.com/posts/rotary_encoder_analog_input.html It works pretty well except for an occasional reverse tick but that's probably a flaw in my code.
  5. The master is talking to 8 slaves using chip select pins on P3. Only 1 pin is pulled low at a time using the ~ operator, so STE is NOT floating. I think I mostly solved my issue with the following code: (By mostly solved I mean I am seeing garbage on MISO when a slave is not present on the active chip select, but that seems to be a checksum issue now) #include <msp430g2553.h> #include <string.h> #include "stdarg.h" enum { /* Port 1 */ LED1 = BIT0 ,LED2 = BIT1 ,CHIP_SELECT = BIT3 }; int main(void){ WDTCTL = WDTPW | WDTHOLD; /* TODO Check if -mdisable-watchdog set.
  6. The following code accepts over the SPI bus a byte from the master to control 8 relays, and returns the state of 8 inputs. I am running into an issue where the slave always responds to the SCLK, driving MISO, even when the STE (pin 1.4) is not asserted low. Any ideas why? #include "msp430g2553.h" #include <string.h> enum { /* Port 1 */ LED1 = BIT0 ,LED2 = BIT1 }; int main(void){ WDTCTL = WDTPW | WDTHOLD; BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ; /* SMCLK = DCO / DIVS = nMHz */ /* ACLK = VLO = ~ 12 KHz */ BCSCTL2 &= ~(DIVS_0); BCSCTL3 |= LFXT1S_2; P2SEL &
  7. Are you looking for a board with a programmer or just a chip on it? I have one for sale on tindie for 6.95 + 2.00 shipping and includes P3.0-P3.7 (no programmer though) https://www.tindie.com/products/analog10/dos-ocho-launchpad-compatible-board-with-28-pins/
  8. Harbor Freight offers a decent deal on a digital gauge that also communicates its reading (much like a Chinese calipers). I built up an MSP430 based solution to retransmit this data via UART and externally power the dial gauge (eliminating the need for a button cell battery). Project details are at https://analog10.com/posts/external_power_for_the_pittsburgh_dial_gauge.html Code is at https://github.com/analog10/Digital_Dial_Gauge_Reader Happy Holidays
  9. I build images on my desktop, then access them from my raspberry-pi via ssh-fs...no need to build them locally.
  10. We have to worry about an edge happening in our critical section initialization. So change initialization as follows. __disable_interrupt(); uint8_t back = PxIES; PxIFG = 0; PxIES = PxIN; /* According to slau144j It's not possible to trigger a fake transition if PxIES is getting set to the same values as PxIN. So if there is a bit on PxIFG we did get an edge just after we set PxIES. */ uint8_t snap = PxIFG; PxIFG = 0; if(snap & BITN){ if(PxIES & BITN) /* emit falling */ else /* emit rising */ } PxIES &= BITN; back &= ~BITN; PxIES |= back; PxIE |= BITN;
  11. You would also want to change BIT0 to BIT2 in this line: ADC10AE0 |= BIT0;
  12. Make sure you don't use a baud rate faster than 9600 baud; the launchpad G2 doesn't work properly going any faster.
  13. You probably can get decent web performance with the TM4C129. You can't use a naive web server though. I've written an embedded web server for my client (on an ARM chip as well) and can recommend the following: 1) Don't buffer the client request; try to parse the request as the data comes in. 98% of your requests are GETs and do not require buffering. Consequently you can boost the number of sockets you can process at a time. 2) I recommended trying Connection: close because I thought the browser may have been trying to reuse the socket and your code didn't seem to support that. Connectio
  14. Doh, I looked at Tone.cpp again and now it makes sense. I had thought Energia would set up the Timer output directly but it actually toggles the POUT in the interrupt handler. I would expect to see a few microseconds of jitter between the cam pulse and the crankshaft pulse that triggered it, but should be OK.
  15. Are you actually getting any output? P2_1 is associated with TimerA1.1. However, Energia's tone() function only works with TimerA0. Choose a different pin that associates with a TimerA0.x output. https://github.com/energia/Energia/blob/master/hardware/msp430/cores/msp430/Tone.cpp
  16. Could your project also do FIFO a la FT245RL?
  17. I'm working on G2553 and below, so I will stick to the ring buffer; not wasting an extra byte is important when you got a dozen buffers. (Note that I am using uglier macro code to cut down on the cycles; I only published cleaner "functional" code to make the concept clearer). The A/B thing sounds good for use on an ARM though.
  18. Why don't you try setting the Connection:close header on the tiger request?
  19. I was just wrestling with the compiler optimizing away whole sections of my code. I found using volatile on the struct stored in the info segment would also eat up RAM. So I defined two variables: the storage variable and the access variable. The storage variable has the info segment attribute, and the access variable is a const volatile pointer to the storage variable, as follows: /* Some configuration settings; this only defines the STORAGE */ static __attribute__((section(".infoc"))) const struct configuration_s s_config_storage = { ... }; /* The pointer we actually use to read the confi
  20. First of all, nobody knows your target platform (Tiva or MSP430)? If you are using MSP430, I strongly advise you (I'm sure others will too) to NOT use float or doubles. You will be very unhappy if you do. Instead used fixed point integers. Perhaps someone else can advise if Tiva supports floating point.
  21. This isn't actually the original code I used; this is the "cleaned up" version to illustrate the concepts. It seems I copied the wrong file up; I made the edits that should fix it.
  22. For my purposes I just needed a simple FIFO buffer, but implementations I saw either wasted a byte of buffer space, required extra fields or were not very performant. This implementation provides full and empty conditions, a count (if you need it, I did not test it, just fair warning). You can add/remove bytes efficiently even if your buffer is not a power of 2 size. #ifndef __REVRING_H__ #define __REVRING_H__ #include <stdint.h> /** @brief Ring buffer that decrements indices as data is stored. */ struct revring_s { unsigned head; unsigned tail; unsigned buffer_size; uint8_t buff
  23. You can see if it's a debouncing issue by hooking the encoder up to TA0CLK line, enabling that function, and looking at TA0R after you click the detentes.
  24. You're at the point where you should expand your toolset. There are 3 things you need to do: 1) Post all your code when asking for help. That is clearly not your entire interrupt handler because the code you showed does not clear the interrupt flag. 2) Count clock cycles I suggest installing naken_util as it contains a utility to count your clock cycles. simply run naken_util -disasm input.hex > output.txt Then look in your .s file to find the address of your interrupt handler. Correlate this address with the one in the output.txt. If you're not sure how to generate al
  25. Make sure you enclose your macro arguments in parentheses when defining the macro, such as #define compilePortInputRegister(port) ((1 == (port)) ? &P1IN : \ ((2 == (port)) ? &P2IN : portInputRegister(port)))
  • Create New...