Shop OBEX P1 Docs P2 Docs Learn Events
SPI SOLVED - Page 10 — Parallax Forums

SPI SOLVED

1567810

Comments

  • Dave HeinDave Hein Posts: 6,347
    edited 2020-08-29 15:40
    I don't think using multiple cogs is the problem. In fact, the use of multiple cogs makes the timing easier. You don't have to wait for serial data, and you don't have to wait when printing stuff to the debug console.

    It seems that there are 2 main issues. The mount is not receiving serial data from the handbox, and the pass-through of the auto signals is not working well. On the serial data issue, you verified that the debug prints work when you type characters on the mount's console. If we received serial data from the handbox, the mount prop should also send out debug prints. Either the handbox is not sending serial data, or there is something wrong with your serial connection between the handbox and the mount.

    I'll create another version of the handbox program to test whether we are sending serial data. Please verify that you have the correct connections between the handbox and the mount. The handbox is sending serial data on P20, and the mount is receiving it on P11. I believe you are using the Flip module, so P20 is on pin 25, and P11 is on pin 16. So you need to connect P20/pin25 on the handbox Flip module to P11/pin16 on the mount module. The two Flip modules need to have their grounds connected to each other. This is important.

    I think the problem with passing through the auto signals, is that the mount program isn't sampling the inputs fast enough. However, you said that auto-North is causing an auto west print, so there may be a connection problem there. Once again, the P I/O numbers don't match the actual pin numbers, so make sure you are using the correct pins. In the program, auto N, S, W and E are P 24, 25, 26 and 27. These correspond to pins 33, 34, 35 and 36 on the Flip module.

  • Dave HeinDave Hein Posts: 6,347
    edited 2020-08-29 15:37
    bbrien, try the attached "Telescope handbox dh5.spin". This is the same as dh1, except that I use the console serial port as the serial data port. This is only a test program to see if the single control characters are sending. It's kind of a pointless sanity check, but please try it anyhow. It works fine for me.
  • bbrien, can you post pictures of your setup? Specifically, I'd like to see a picture that shows the wires going from the handbox Flip module to the mount Flip modules. I'd also like to see a picture that shows the auto NSWE buttons, and the wires connecting them to the mount Flip module. Maybe the pictures will show if there is a connection problem.
  • T.M.dh7 T.H.dh1
    AUTO_N = 4 NORTH = 3
    AUTO_S = 5 SOUTH = 4
    AUTO_W = 6 EAST = 5
    AUTO_E = 7 WEST = 6
    RA_SPEED = 13 RATE = 7
    RA_DIR = 12 LED_1 = 24
    DEC_SPEED = 15 LED_2 = 25
    DEC_DIR = 14 LED_3 = 26
    TX = 10 LED_4 = 27
    RX = 11 RX = 21
    TX = 20

    These are the current pin numbers that I am using in my programs. I had to change all your pin numbers to these. This is how my boards are wired.
    1152 x 864 - 414K
    1152 x 864 - 402K
    1152 x 864 - 401K
  • Try this mount program. I changed the way the auto bits are sampled, and it should work better.

    Are you using two PCs to connect to the two Flip modules. It looks like you are powering them off of USB. If one of your PCs is a laptop it may have a floating ground, so the two Flip modules won't have a common ground unless you connect the grounds together. I didn't see a ground wire connected between the two Flips. Maybe that's your problem with serial communications.

  • I use a 9.6 v battery with a v.r. to provide 9v the two flips connect to the same pc and I switch between the flips at the serial monitor to read the prints.
    on the dh5 I get these readings; mode 1; (N), 1. (S), 2. (E), 8. (W), 4.
    mode 2; (N), A. (S), B. (E), H. (W), D. mode 3; (N), Q. (S), R. (E), X. (W), T.
    mode 4; (N), a. (S), b. (E), h. (W), d.
  • Tried the dh8 version but no function on the AUTO buttons now and no function from the hand control.
  • The results from dh5 look good. I have attached a new handbox program, which is version dh9. This is the same as dh1, but with your pin numbers. So please use dh9 on the handbox, and dh8 on the mount. I'll try to duplicate your setup with two QuickStart cards that I have. However, dh9 and dh8 should work on your hardware.

    I suspect you may have some wiring issues on the auto buttons. They should be wired the same as the NSWE buttons on the hand controller, with pulldown resistors to ground, and normally open switches connected to 3.3V.

    I don't understand why the serial line isn't working from the handbox to the mount. If I understand correctly, you are using a single 9-volt battery, correct? With the two USBs connected to the same computer you must have a common ground between the two Flip cards. It looks like you have a wire running from P20 on the handbox to P11 on the mount, so it should work.
  • Dave HeinDave Hein Posts: 6,347
    edited 2020-08-30 00:06
    bbrien, I loaded the EEPROMs on two of my QuickStart cards with "Telescope handbox dh9" and "Telescope mount dh8". I then connected P20 to P11 with the green wire shown in the picture. It works great!. The handbox sends the NSWE switch settings to the mount through the serial port. The mount responds to button pushes and displays them on the console as auto changes.

    I don't know why this isn't working for you. It should work. Have you tried programming the EEPROMs? Maybe that will help in case your boards are resetting for some reason.
    785 x 543 - 159K
    qs2.jpg 159.4K
  • bbrienbbrien Posts: 561
    edited 2020-08-30 00:29
    None of my motors run from the AUTO switches and the ra should be running at startup but now it doesn't unless you press a button on the AUTO set. nothing from the hand box yet. When I use dh7 The motors do work but nothing from hand box.
  • But does the mount's console display show anything? I'll look into the motor control. They may require a periodic call from the main cog.

    The serial signaling between the handbox and the mount isn't rocket science. As you can see in my picture, it just requires a single wire from P20 to P11 as long as you have a common ground. If you're not receiving serial data on the mount you must have a wiring problem. Fix the wiring problem, and serial will work. Maybe you fried the the I/O pins on one of your Props. Try different pins to see if they work.

    Try running the mount program on your handbox Flip card. See if the NSWE buttons cause AUTO prints on the console screen.

  • I found the problem with the motor driver in the mount program. I fixed it, and the new mount program is attached below. I measured the average voltage on the DEC pin, and I got voltages of 0.497, 0.994, 1.491 and 1.987 for north or south in the four modes. The direction pin was low for north, and high for south. The voltage was zero when north or south wasn't selected.

    For RA I measured a voltage of 0.248 when east or west weren't selected. For west I got 0.746, 1.243, 1.740 and 2.237 for the four modes. For east I got 0.248, 0.746, 1.243 and 1.740 for the four modes. The direction pin was low for west, and high for east.

  • Will have to check out every thing over the next day or so.
  • bbrienbbrien Posts: 561
    edited 2020-09-03 00:57
    Ok D Hein ,I have Checked all of my wiring and tried 5 different tx and rx pins on both of my brand new flip modules and I dont get any communication between the boardswhen I touch the jump wire i get some activity on the terminal and still no motor action on the auto_pins(switches). I think it has something to do with the "waitcnt(CNT+80000). The RA motor should start rotating at 7_5 upon power-up + 2-3 seconds.
    Also please tell me about the program on your test with the Quick-start boards in the picture.(Maybe send copies).
  • Dave HeinDave Hein Posts: 6,347
    edited 2020-09-03 16:25
    bbrien, the software works. I've verified it using my QuickStart boards. The waitcnt(CNT+80000) was added to wait for a cog to start up, but I don't think it's necessary. It certainly won't cause things to not work.

    As I said in the post with the picture, I used dh9 and dh8 for the tests with the QuickStart boards. Those versions were attached to earlier posts. I fixed the motor problem in dh10, so at this point you should use "Telescope handbox dh9" and "Telescope mount dh10". Those programs work correctly in my tests.

    Ignore the handbox, and just run "Telescope mount dh10" on the mount Flip board. You should see movement on the RA motor when you start up the program. You should get a print every 10 seconds on the console monitor. You should be able to type the characters 1, 2, 4, 8, A, B, D, H, Q, R, T, X, a, b, d and h on the console keyboard, and see movement in the motors. You should be able to push the NSWE auto buttons, and see movement on the motors. If this is not working, then you have a hardware problem. Please try these tests with dh10, and let me know what works, and what doesn't work.

    EDIT: Make sure you burn the programs into the EEPROMs just in case you have some kind of intermittent reset problem. To program the EEPROMs use the F11 key instead of the F10 key.
  • I get no function on the Auto buttons in DH10 but I do have function withDH7."AUTO_NEW Isn't calling the output pins.When I use the console and type something I do get motion on both motors but in the field I will only have the hand box and guide camera.
  • I found the problem in dh10. rxcheck returns a value of -1 when there is no received character. So rx_new had a value of -1, which prevented the code from handling auto_new correctly. I've fixed this in the attached "Telescope mount dh11.spin" file. Try this version out to see if works OK for you.
  • I would but now I can't get the a port on the system any more ." cannot find device on any port".
  • This thread reminds me of a high-frequency repetitive sawtooth waveform. It has a steep up-hill ramp and once you get to the top, it crashes back down to zero again, then you start all over again ad infinitum :)

    YGfyx.png
    Patience and perseverance will keep you going .... with no end in sight.
  • Hi; Dave , Still waiting on new chips, tried my old originalpropeller chip but it has developed a problem, it pulses the pwm on and off and everything else. Four or five 1.5ms pulses and then nothing and then another four to five 1.5ms pulses. its about ten years old.
  • Hi Dave; I was testing the dh11 version before I shorted out the project board, first thing that caught my eye is that the tracking motor does not automatically start turning until I push a button on the Auto_set. I am thinking that the test for serial should come after the AUTO_set or on a different cog with a branch to outputs which means pausing the main cog.
  • When motor.start is called it initializes the motor speeds to zero. motor.set_speed is called when the update flag is set, which only happens when there is a change in the auto value or in the serial byte. In the attached dh12 version I added a call to motor.set_speed(RA,SIDE_RATE) just before entering the main repeat loop. This should fix the startup problem.
  • kwinnkwinn Posts: 8,697
    This thread reminds me of a high-frequency repetitive sawtooth waveform. It has a steep up-hill ramp and once you get to the top, it crashes back down to zero again, then you start all over again ad infinitum :)

    Patience and perseverance will keep you going .... with no end in sight.

    LOL, My patience and perseverance have decreased quite a bit over the years, and like your waveform crashes to zero and after a few cycles.
  • By the looks of that breadboard project your not going to know if you have a program glitch, blown pin, or loose connection. The prop could function normal and you still could have a bad pin, making you think you have a program glitch. I wouldn't want to sloppy breadboard using $35 flip modules. On my boards if I blow a pin I just swap out a $7 dip40. It happens ounce in a while if a loose jumper touches the 5V. Blown about 2 in the last several years.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-09-09 01:01
    DigitalBob wrote: »
    By the looks of that breadboard project your not going to know if you have a program glitch, blown pin, or loose connection. The prop could function normal and you still could have a bad pin, making you think you have a program glitch. I wouldn't want to sloppy breadboard using $35 flip modules. On my boards if I blow a pin I just swap out a $7 dip40. It happens ounce in a while if a loose jumper touches the 5V. Blown about 2 in the last several years.

    But he can't leave it on plugin breadboard forever so he has to mount them on matrix board eventually anyway. Besides unless the FLiP has smaller pins, the standard pin headers deform plugin breadboards and lead to faulty connections.
    He needs to mount the stuff onto matrix board now and use wirewrap wire to solder it up and then he will know that he is not going to have stupid things happen because of a loose wire. Neither should he try to use 40-pin IC sockets for the FLiP as it needs proper pin header sockets to match.

    The matrix boards should be quality double-side plated through and cut down to mount inside the case. I know my local Jaycar stores here only stock cheap veroboard or cheap bendy single sided bare copper matrix!!@$#$! Yet, just 5 minutes down the road is my mate Daniel from Protostack with stacks of quality matrix boards at much the same a cheaper price.

    Anyway, the fact that a sawtooth crashes back to zero after a steep climb is not a fault, it is the nature of the beast ;)


  • As you might not realize , I'm not totally dumb as I have ordered a new set of 40 pin dip chips and the new flip modules will only be used on the completed product using fabricated circuit boards.As soon as i get the chips I will continue testing and reporting the results with Dave H.
  • Putting a socket on a matrix board and soldering up the few connections doesn't take long at all and is reliable so it can be made as the final product rather than "fabricated circuit boards" which begs the question, aren't you the same guy that couldn't unzip a normal zip file that I sent you? How are you going to design and fabricate circuit boards???
  • Peter, please, let it go...
    Have mercy on the guy :).
    I still hope he'll come to his senses...
  • Maciek wrote: »
    Peter, please, let it go...
    Have mercy on the guy :).
    I still hope he'll come to his senses...

    Well, for some reason I still try to reason with him for his own good although it's as if he is planning to fail. He is not doing himself any favors using that mangle of breadboards and yet it would be so so easy to take a few hours and mount it properly instead of having to order more chips and finding more fingers to cross. But when he said "fabricated circuit boards", well, that was it!
  • bbrienbbrien Posts: 561
    edited 2020-09-09 18:13
    fabricating is easy 1; draw schematic in Kicad 2; route board. 3; send G. files to Osh Park. 3 boards for $5.00/square inch.
    I also learned to unzip zipped files.
    595 x 337 - 71K
Sign In or Register to comment.