Shop OBEX P1 Docs P2 Docs Learn Events
SX48 and Datalogger — Parallax Forums

SX48 and Datalogger

hsvkevinhsvkevin Posts: 16
edited 2008-06-06 23:48 in General Discussion
Hi,
I am new to the SX chip but from reading about it it sounds perfect for a project I need for work. I'm trying to interface with a Memory Stick Datalogger and when I hook it up, I get a green and red flashing light. I have the jumper in UART mode, and ground on pin 1, 5V on pin 3, and data lines on pins 2,4,5 and 6. Any suggestions?


Thanks,

Kevin

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-05-28 14:22
  • hsvkevinhsvkevin Posts: 16
    edited 2008-05-28 15:04
    Hmmm, I still get the flashing red and green with Bean's code. I don't have a resonator yet. I'll have to go find one.
  • hsvkevinhsvkevin Posts: 16
    edited 2008-06-05 14:36
    Ok I got a resonator. I'm using a 50 mhz but I also have a 20 mhz. It is still flashing red and green abd the usb drive never flashes. Any ideas? I'm trying Beans code again



    Thanks
  • BeanBean Posts: 8,129
    edited 2008-06-05 14:54
    Did you notice this note ? " *** Note that RX on the SX connects to TXD on the datalogger, and so forth for all the connections."

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?

    www.iElectronicDesigns.com

    ·
  • hsvkevinhsvkevin Posts: 16
    edited 2008-06-05 15:08
    Hmmmm, I followed the connections in the comments, I think. I'll double check.


    ' Make sure datalogger red jumper is in UART mode
    CTS··· PIN RA.0 INPUT· ' Connect to datalogger pin 2(RTS)
    TX···· PIN RA.1 OUTPUT ' Connect to datalogger pin 4(RXD)
    RX···· PIN RA.2 INPUT· ' Connect to datalogger pin 5(TXD)
    RTS··· PIN RA.3 OUTPUT ' Connect to datalogger pin 6(CTS)


    Thanks
  • hsvkevinhsvkevin Posts: 16
    edited 2008-06-05 15:14
    IT might be worth mentioning that I am still using the 50mhz resonator and this is the init stuff in the top of the code:


    DEVICE SX48, OSCXT2, TURBO, OPTIONX, STACKX
    FREQ 4_000_000
    ' Make sure datalogger red jumper is in UART mode
    CTS··· PIN RA.0 INPUT· ' Connect to datalogger pin 2(RTS)
    TX···· PIN RA.1 OUTPUT ' Connect to datalogger pin 4(RXD)
    RX···· PIN RA.2 INPUT· ' Connect to datalogger pin 5(TXD)
    RTS··· PIN RA.3 OUTPUT ' Connect to datalogger pin 6(CTS)
    LED··· PIN RB.0 OUTPUT ' Turns on finished


    Thanks
    ·
  • ZootZoot Posts: 2,227
    edited 2008-06-05 15:44
    Try changing FREQ 4_000_000 to FREQ 50_000_000.

    When you run it, if the Key is connected, pop out the resonator; if the Key is not connected, put the resonator in (it's either/or).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • hsvkevinhsvkevin Posts: 16
    edited 2008-06-05 17:00
    This is weird. I tried changing FREQ 4_000_000 to FREQ 50_000_000. When that didn't work, just on a whim, I plugged in the 20mhz resonator and put in 20_000_000 and somehow it worked.(the lights stopped flashing) I sure can't explain that, but I really appreciate you guys help. Its not writing the file yet, but hopefully I can figure that one out.

    Thanks everyone!
  • hsvkevinhsvkevin Posts: 16
    edited 2008-06-05 17:01
    And my usb drive was formated ntfs, so that is probably my other problem

    Thanks again
  • ZootZoot Posts: 2,227
    edited 2008-06-05 18:09
    The FREQ directive lets the compiler know what the "expected" frequency of the clock will be. This can affect code (it depends on the code of course).

    The SX itself doesn't care what the FREQ directive is -- it will be clocked at whatever the frequency is of the connected resonator/crystal/clock (or the clock generated from the SX-Key).

    So, I could put FREQ 4_000_000 and hook up a 20MHZ resonator and the SX will run at 20MHZ. BUT if there is timing (i.e. clock) dependent code in the application, things may not work as expected. Higher-level SX/B commands like PULSIN, PULSOUT, SERIN, SEROUT, etc. will be especially susceptible to incorrect FREQ settings.

    Somebody said...
    20mhz resonator and put in 20_000_000

    So the above would be CORRECT. If you have a FREQ of 4_000_000 and an attached 20MHZ resonator, things could get screwy (depending on the code).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • hsvkevinhsvkevin Posts: 16
    edited 2008-06-05 18:43
    Hmm, It looks like it is running right, but it never actually writes data to the drive. The lights blink green, but the drive is always empty. I formatted it fat. Any suggestions?
  • hsvkevinhsvkevin Posts: 16
    edited 2008-06-06 13:42
    Ok I have made a second setup with another datalogger, on a new sx28 board, with a different 20 mhz resonator using the good source code from Bean(I only changed 4_000_000 to 20_000_000). The only other thing I can guess it could be is the usb drive. HAs anyone experienced this? It is a pain in the Smile to get USB sticks in this building, so before I go beg security to let me bring another one in, I was just wondering if anyone knew of any issues.


    Thanks!
  • hsvkevinhsvkevin Posts: 16
    edited 2008-06-06 14:45
    Nevermind. I borrowed another USB stick and it works. At least now I know why my boss let me have his old one.

    Thanks for all of the help guys. I really appreciate it.
  • ZootZoot Posts: 2,227
    edited 2008-06-06 23:48
    Glad you got it working.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
Sign In or Register to comment.