Jump to content

lalalandrus

Members
  • Content Count

    16
  • Joined

  • Last visited

  • Days Won

    2

lalalandrus last won the day on May 2 2013

lalalandrus had the most liked content!

About lalalandrus

  • Rank
    Member
  1. yes it came with keyless entry, it just was cumbersome especially when the remote is the size of texas AND i fried my remote one day perhaps i should call this "proximity entry"
  2. website states it requires 5v ttl which *should* work if you are using 3.3 cmos BUT you as rob said perhaps you need a 5v supply
  3. clock the hardware spi faster and use both on the same bus. the csn should be able to take care of it. bitbanged spi can be quite fast, but then you just have no time to process anything else.... i posted this in another thread recently of a bit banged spi (CPOL and CPHA = 0 ) uint8_t spi_send(const uint8_t _data) { const uint8_t MOSI = BIT7; const uint8_t MISO = BIT6; const uint8_t SCK = BIT5; uint8_t data = 0; if (_data & 0x80) P1OUT |= BIT7; else P1OUT &= BIT7; __delay_cycles(10); for (int i = 0 ; i < 8 ; i++) { if (_data & (1 << (7-i))) P1OUT |= BIT7; else P1OUT &= BIT7; data |= (P1IN & MISO) << (7-i); __delay_cycles( 4); P1OUT |= SCK; __delay_cycles( 8); P1OUT &= SCK; } return data; }
  4. In this day and age, we should not need to use any keys or buttons. I have done away with the key remote in my car using this simple setup. I came to the same conclusion as this gentlemen in using the apple nike+ sensor to provide a proximity sensor to the car. https://www.sparkfun.com/tutorials/135 His code lacks a couple things that I was looking for. 1) decoding of the apple serial protocol so that i can use any NRF module 2) detection of when to stop strobing the remote (when the key is inserted) 3) ability to open the trunk and since I can detect when the key is inserted, I can do other things when the car is on like strobing the garage door opener, To accomplish 1, I found that some genius went about decoding the modules to be decoded with NRF modules http://dmitry.gr/index.php?r=05.Projects&proj=05.%20Nike%20plus%20iPod Also helping this along was energia and the already written NRF24 library. notes about my design and things I learned: - my design is based all on a repeating 10ms timer which is a good base for modifying this code to work for different scenarios - i am a fpga designer and some of the code is not as efficient as a c++ programmer would make it - one could optimize the interrupt routine to use less time by using a global counter and variables to store offsets rather than individual counters - my mazda remote is active low so the signals had to be inverted - i tapped into my car through the mazda keyless module. 12v and gnd is provided. an additional signal which pullses low at a 1khz rate when there is no key inserted, it is high when a key is inserted, this powers "car timeout" - i originally had everything on one board, but it seemed there was too much interference for the NRF to pick up the sensor properly - since there were a lot of rf devices decoupling capacitors was very necessary. - there is a 24 second timeout before my car relocks if there is no door opened, i kludged a single button press keep alive every 20 seconds using delays :-( i dont like using delays they seems so unclean.... an upgrade would be to use the -64dbm to detect that you are actually in the car and stop the strobing, ymmv and i have not implemented this (RPD register 0x09 bit 0) UPDATE: IMPLEMENTED IN NEWEST CODE - whenever the key is in the car, the car will cycle every ~2.5 seconds through the two parkade doors. the remote will auto shutdown if it detects a constant press so i have added a remote_pause to prevent this - the trunk has another msp430 performing capsense on the key hole and will activate another nike+ sensor to open the trunk. i am in the process of upgrading the sensitivity of this using swept frequency capacitive touch which i will share once i get the kinks out - a cheap chinese buck module was used to reducethe voltage from 12v to 3.3v - replace the *_sn vectors with whatever your nike+ sensor serial number is - avoid RF like the plague, even with one side guaranteed to be working, along with some issues with SPI, it was a PITA to get working the first time nikerf.ino printf.h
  5. the timer way is probably the way to go, but if you are short on timers, you can always use the WDT in interval mode...
  6. one can implement a simple RC circuit to debounce as well. it is implemented on the launchpad for pin 1.3. look at the schematic another way to use once in the interrupt__delay_cycles(n) to debounce it n cycles within the interrupt, not the most efficient but it will do to get one started.
  7. or get another launchpad or equivalent to talk to and take data from one serial port and pipe it out on the other. if the other chip doesnt have hardware serial, you can always bit bang it out. lots of examples on the web. crazier yet, loop it back to the same micro using the bit bang SPI code snippet for bit bang spi: (CPOL and CPHA = 0 ) uint8_t spi_send(const uint8_t _data) { const uint8_t MOSI = BIT7; const uint8_t MISO = BIT6; const uint8_t SCK = BIT5; uint8_t data = 0; if (_data & 0x80) P1OUT |= BIT7; else P1OUT &= BIT7; __delay_cycles(10); for (int i = 0 ; i < 8 ; i++) { if (_data & (1 << (7-i))) P1OUT |= BIT7; else P1OUT &= BIT7; data |= (P1IN & MISO) << (7-i); __delay_cycles( 4); P1OUT |= SCK; __delay_cycles( 8); P1OUT &= SCK; } return data; }
  8. the ftdi method only works if the bootloader (cfe.bin) is still intact. in my case my bjorked the boot partition in the flash chip and thus needed the nitty gritty jtag to restore it.
  9. final update: i was annoyed at how long it took, i have upgraded the protocols and now the jtag only takes 30 min to back up 256k notes: - baud rate slowed as the micro was unable to keep up (9600 probably wouldnt be that much slower and could use the application UART) - bytes transfered rather than bit banging - micro changed to a MSP435G2553 uploaded are the files i have modified main_new.c binary.h jt_mods.c jt_mods.h tjtag.c
  10. yeah i am using an older msp430 kit so no 16Mhz calibrations and yes, the router is fixed but took literally days, backing up the 128k CFE took three days even though I didnt need it. wrtiting is a little faster at one-ish day. EDIT: new findings - the speed will double if you recompile tjtag-jtmod to disregard the ACKS from every write. - max serial speed is 160000 BAUD which will speed it another 50%
  11. Playing around with my router and bricked it. Needed a JTAG but most are done with parallel ports. Google search brought me here to this project. http://sourceforge.net/projects/tjtag/files/v3.0.1-JTMOD/ I ported the code to a MSP430. Changing pinouts should be relatively straight forward in the DEFINES. Note that it uses 115200. The Launchpad application uart only supports 9600. To get 115200, you have to use an external serial cable (i used a FTDI cable). Also, it runs at 16MHz which requires you to do the DCO calibration and modify the msp430 includes to define the 16MHz selection. The only downside is that although it works, it is very slow. main.c #include "msp430g2231.h" #include "stdint.h" #include "intrinsics.h" #include "binary.h" //------------------------------------------------------------------------------ // Hardware-related definitions //------------------------------------------------------------------------------ #define UART_TXD BIT1 // TXD on P1.1 (Timer0_A.OUT0) #define UART_RXD BIT2 // RXD on P1.2 (Timer0_A.CCI1A) //------------------------------------------------------------------------------ // Conditions for 9600 Baud SW UART, SMCLK = 1MHz //------------------------------------------------------------------------------ #define UART_TBIT_DIV_2 (16000000 / (115200 * 2)) #define UART_TBIT (16000000 / 115200) //------------------------------------------------------------------------------ // Global variables used for full-duplex UART communication //------------------------------------------------------------------------------ unsigned int txData; // UART internal variable for TX unsigned char rxBuffer[100]; // Received UART character int bytecnt; // Received UART character //------------------------------------------------------------------------------ //JTAG //------------------------------------------------------------------------------ #define WRST_N 7 //BIT0 #define WTMS 5 //BIT3 #define WTCK 6 //BIT4 #define WTDI 3 //BIT6 #define WTRST_N 0 //BIT7 #define WTDO 4 //BIT5 typedef enum __arduOp { OP_RESET = 0, OP_SEND = 1, OP_READ = 2, OP_RSVD = 3 } arduOp; //__no_operation(); //__delay_cycles( 3000 ); //------------------------------------------------------------------------------ // Function prototypes //------------------------------------------------------------------------------ void TimerA_UART_init(void); void TimerA_UART_tx(unsigned char byte); void TimerA_UART_print(char *string); unsigned char serial_getch(void); //------------------------------------------------------------------------------ // main() //------------------------------------------------------------------------------ int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer DCOCTL = 0x00; // Set DCOCLK to 16MHz BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ; P1SEL = UART_TXD + UART_RXD; // Timer function for TXD/RXD pins P1DIR = 0xFF & ~UART_RXD & ~(1 << WTDO); // Set all pins but RXD to output P1OUT = 0x00; bytecnt = -1; __enable_interrupt(); TimerA_UART_init(); // Start Timer_A UART TimerA_UART_tx(0x7F); while(1) { static unsigned char temp = 0; static unsigned char byte = 0; byte = serial_getch(); // Wait for incoming character unsigned char op = (byte & B01100000) >> 5 ; switch ( op ) { case OP_RESET: { // Clear all outputs. P1OUT = 0x00; // Respond that we're ready to go. TimerA_UART_tx(0x42); bytecnt = -1; } break; case OP_SEND: { // Set output pins to requested values. temp = 0; temp |= ((byte & B00010000) >> 4 ) << WTRST_N; temp |= ((byte & B00001000) >> 3 ) << WTDI; temp |= ((byte & B00000100) >> 2 ) << WTCK; temp |= ((byte & B00000010) >> 1 ) << WTMS; temp |= ((byte & B00000001) >> 0 ) << WRST_N; P1OUT = temp | (P1OUT & UART_TXD); // If needed: put a TimerA_UART_tx() here so that // we can "wait" for the pins to be set. TimerA_UART_tx(0x4B); } break; case OP_READ: { unsigned char readByte = (P1IN & (1 <<WTDO)) == 0 ? // WTDO B00000000 : // send back a 1 in bit 7 B10000000; // send back a 0 in bit 7 TimerA_UART_tx(readByte); } break; default: { TimerA_UART_tx(0x7F); } }; } } //------------------------------------------------------------------------------ // Function configures Timer_A for full-duplex UART operation //------------------------------------------------------------------------------ void TimerA_UART_init(void) { TACCTL0 = OUT; // Set TXD Idle as Mark = '1' TACCTL1 = SCS + CM1 + CAP + CCIE; // Sync, Neg Edge, Capture, Int TACTL = TASSEL_2 + MC_2; // SMCLK, start in continuous mode } //------------------------------------------------------------------------------ // Outputs one byte using the Timer_A UART //------------------------------------------------------------------------------ void TimerA_UART_tx(unsigned char byte) { while (TACCTL0 & CCIE); // Ensure last char got TX'd TACCR0 = TAR; // Current state of TA counter TACCR0 += UART_TBIT; // One bit time till first bit TACCTL0 = OUTMOD0 + CCIE; // Set TXD on EQU0, Int txData = byte; // Load global variable txData |= 0x100; // Add mark stop bit to TXData txData <<= 1; // Add space start bit } //------------------------------------------------------------------------------ // Prints a string over using the Timer_A UART //------------------------------------------------------------------------------ void TimerA_UART_print(char *string) { while (*string) { TimerA_UART_tx(*string++); } } //------------------------------------------------------------------------------ // serial_getch - wait and return a char //------------------------------------------------------------------------------ unsigned char serial_getch(void) { // Wait for incoming character if (bytecnt < 0) { __bis_SR_register(LPM0_bits);} bytecnt--; // TimerA_UART_tx(rxBuffer[bytecnt+1]); return rxBuffer[bytecnt+1]; } //------------------------------------------------------------------------------ // Timer_A UART - Transmit Interrupt Handler //------------------------------------------------------------------------------ #pragma vector = TIMERA0_VECTOR __interrupt void Timer_A0_ISR(void) { static unsigned char txBitCnt = 10; TACCR0 += UART_TBIT; // Add Offset to CCRx if (txBitCnt == 0) { // All bits TXed? TACCTL0 &= ~CCIE; // All bits TXed, disable interrupt txBitCnt = 10; // Re-load bit counter } else { if (txData & 0x01) { TACCTL0 &= ~OUTMOD2; // TX Mark '1' } else { TACCTL0 |= OUTMOD2; // TX Space '0' } txData >>= 1; txBitCnt--; } } //------------------------------------------------------------------------------ // Timer_A UART - Receive Interrupt Handler //------------------------------------------------------------------------------ #pragma vector = TIMERA1_VECTOR __interrupt void Timer_A1_ISR(void) { static unsigned char rxBitCnt = 8; static unsigned char rxData = 0; switch (TAIV) { // Use calculated branching case TAIV_TACCR1: // TACCR1 CCIFG - UART RX TACCR1 += UART_TBIT; // Add Offset to CCRx if (TACCTL1 & CAP) { // Capture mode = start bit edge TACCTL1 &= ~CAP; // Switch capture to compare mode TACCR1 += UART_TBIT_DIV_2; // Point CCRx to middle of D0 } else { rxData >>= 1; if (TACCTL1 & SCCI) { // Get bit waiting in receive latch rxData |= 0x80; } rxBitCnt--; if (rxBitCnt == 0) { // All bits RXed? rxBuffer[bytecnt+1] = rxData; // Store in global variable bytecnt = ((bytecnt < sizeof(rxBuffer)) ? (bytecnt + 1) : 0); rxBitCnt = 8; // Re-load bit counter TACCTL1 |= CAP; // Switch compare to capture mode __bic_SR_register_on_exit(LPM0_bits); // Clear LPM0 bits from 0(SR) } } break; } } //------------------------------------------------------------------------------ binary.h #define B00000000 0x00 #define B00000001 0x01 #define B00000010 0x02 #define B00000011 0x03 #define B00000100 0x04 #define B00000101 0x05 #define B00000110 0x06 #define B00000111 0x07 #define B00001000 0x08 #define B00001001 0x09 #define B00001010 0x0A #define B00001011 0x0B #define B00001100 0x0C #define B00001101 0x0D #define B00001110 0x0E #define B00001111 0x0F #define B00010000 0x10 #define B00010001 0x11 #define B00010010 0x12 #define B00010011 0x13 #define B00010100 0x14 #define B00010101 0x15 #define B00010110 0x16 #define B00010111 0x17 #define B00011000 0x18 #define B00011001 0x19 #define B00011010 0x1A #define B00011011 0x1B #define B00011100 0x1C #define B00011101 0x1D #define B00011110 0x1E #define B00011111 0x1F #define B00100000 0x20 #define B00100001 0x21 #define B00100010 0x22 #define B00100011 0x23 #define B00100100 0x24 #define B00100101 0x25 #define B00100110 0x26 #define B00100111 0x27 #define B00101000 0x28 #define B00101001 0x29 #define B00101010 0x2A #define B00101011 0x2B #define B00101100 0x2C #define B00101101 0x2D #define B00101110 0x2E #define B00101111 0x2F #define B00110000 0x30 #define B00110001 0x31 #define B00110010 0x32 #define B00110011 0x33 #define B00110100 0x34 #define B00110101 0x35 #define B00110110 0x36 #define B00110111 0x37 #define B00111000 0x38 #define B00111001 0x39 #define B00111010 0x3A #define B00111011 0x3B #define B00111100 0x3C #define B00111101 0x3D #define B00111110 0x3E #define B00111111 0x3F #define B01000000 0x40 #define B01000001 0x41 #define B01000010 0x42 #define B01000011 0x43 #define B01000100 0x44 #define B01000101 0x45 #define B01000110 0x46 #define B01000111 0x47 #define B01001000 0x48 #define B01001001 0x49 #define B01001010 0x4A #define B01001011 0x4B #define B01001100 0x4C #define B01001101 0x4D #define B01001110 0x4E #define B01001111 0x4F #define B01010000 0x50 #define B01010001 0x51 #define B01010010 0x52 #define B01010011 0x53 #define B01010100 0x54 #define B01010101 0x55 #define B01010110 0x56 #define B01010111 0x57 #define B01011000 0x58 #define B01011001 0x59 #define B01011010 0x5A #define B01011011 0x5B #define B01011100 0x5C #define B01011101 0x5D #define B01011110 0x5E #define B01011111 0x5F #define B01100000 0x60 #define B01100001 0x61 #define B01100010 0x62 #define B01100011 0x63 #define B01100100 0x64 #define B01100101 0x65 #define B01100110 0x66 #define B01100111 0x67 #define B01101000 0x68 #define B01101001 0x69 #define B01101010 0x6A #define B01101011 0x6B #define B01101100 0x6C #define B01101101 0x6D #define B01101110 0x6E #define B01101111 0x6F #define B01110000 0x70 #define B01110001 0x71 #define B01110010 0x72 #define B01110011 0x73 #define B01110100 0x74 #define B01110101 0x75 #define B01110110 0x76 #define B01110111 0x77 #define B01111000 0x78 #define B01111001 0x79 #define B01111010 0x7A #define B01111011 0x7B #define B01111100 0x7C #define B01111101 0x7D #define B01111110 0x7E #define B01111111 0x7F #define B10000000 0x80 #define B10000001 0x81 #define B10000010 0x82 #define B10000011 0x83 #define B10000100 0x84 #define B10000101 0x85 #define B10000110 0x86 #define B10000111 0x87 #define B10001000 0x88 #define B10001001 0x89 #define B10001010 0x8A #define B10001011 0x8B #define B10001100 0x8C #define B10001101 0x8D #define B10001110 0x8E #define B10001111 0x8F #define B10010000 0x90 #define B10010001 0x91 #define B10010010 0x92 #define B10010011 0x93 #define B10010100 0x94 #define B10010101 0x95 #define B10010110 0x96 #define B10010111 0x97 #define B10011000 0x98 #define B10011001 0x99 #define B10011010 0x9A #define B10011011 0x9B #define B10011100 0x9C #define B10011101 0x9D #define B10011110 0x9E #define B10011111 0x9F #define B10100000 0xA0 #define B10100001 0xA1 #define B10100010 0xA2 #define B10100011 0xA3 #define B10100100 0xA4 #define B10100101 0xA5 #define B10100110 0xA6 #define B10100111 0xA7 #define B10101000 0xA8 #define B10101001 0xA9 #define B10101010 0xAA #define B10101011 0xAB #define B10101100 0xAC #define B10101101 0xAD #define B10101110 0xAE #define B10101111 0xAF #define B10110000 0xB0 #define B10110001 0xB1 #define B10110010 0xB2 #define B10110011 0xB3 #define B10110100 0xB4 #define B10110101 0xB5 #define B10110110 0xB6 #define B10110111 0xB7 #define B10111000 0xB8 #define B10111001 0xB9 #define B10111010 0xBA #define B10111011 0xBB #define B10111100 0xBC #define B10111101 0xBD #define B10111110 0xBE #define B10111111 0xBF #define B11000000 0xC0 #define B11000001 0xC1 #define B11000010 0xC2 #define B11000011 0xC3 #define B11000100 0xC4 #define B11000101 0xC5 #define B11000110 0xC6 #define B11000111 0xC7 #define B11001000 0xC8 #define B11001001 0xC9 #define B11001010 0xCA #define B11001011 0xCB #define B11001100 0xCC #define B11001101 0xCD #define B11001110 0xCE #define B11001111 0xCF #define B11010000 0xD0 #define B11010001 0xD1 #define B11010010 0xD2 #define B11010011 0xD3 #define B11010100 0xD4 #define B11010101 0xD5 #define B11010110 0xD6 #define B11010111 0xD7 #define B11011000 0xD8 #define B11011001 0xD9 #define B11011010 0xDA #define B11011011 0xDB #define B11011100 0xDC #define B11011101 0xDD #define B11011110 0xDE #define B11011111 0xDF #define B11100000 0xE0 #define B11100001 0xE1 #define B11100010 0xE2 #define B11100011 0xE3 #define B11100100 0xE4 #define B11100101 0xE5 #define B11100110 0xE6 #define B11100111 0xE7 #define B11101000 0xE8 #define B11101001 0xE9 #define B11101010 0xEA #define B11101011 0xEB #define B11101100 0xEC #define B11101101 0xED #define B11101110 0xEE #define B11101111 0xEF #define B11110000 0xF0 #define B11110001 0xF1 #define B11110010 0xF2 #define B11110011 0xF3 #define B11110100 0xF4 #define B11110101 0xF5 #define B11110110 0xF6 #define B11110111 0xF7 #define B11111000 0xF8 #define B11111001 0xF9 #define B11111010 0xFA #define B11111011 0xFB #define B11111100 0xFC #define B11111101 0xFD #define B11111110 0xFE #define B11111111 0xFF
  12. oh where to begin... i did a quick search and here are some notes i see you have a ton of wires soldered. try focusing on just the TX. GND and VCC from the GPS for now. (GPS TX to Launchpad RX and remove jumper) 1) it speaks UART yay! default baud rate is 9600 double yay! default outputs GPS and GSV NMEA data every second triple yay! 2) adapt the above code by using only the GPS decoding functions, then implement the serial functions to grab the data from the serial port 3) alternatively, load energia with the hardware and then use the GPS library from arduino, 4) hook up only the GPS tx to the micro RX and have the micro TX still jumpered to the launchpad application UART then just echo the datat to check the connections and everything is working 5) move on from 4 and send formatted decoded data and see that everything else is working.
  13. try moving your flag clear as the first line into the interrupt. also as a good rule of thumb, you should disable interrupts while you are servicing one so you reduce race conditions. that is basically what my line does is disable interrupts entirely until you are good and ready .
  14. try replacing the following LPM0_EXIT; with: _BIC_SR_IRQ(LPM0_bits + GIE)
×
×
  • Create New...