**** BEGIN LOGGING AT Thu Feb 18 02:59:56 2021 Feb 18 21:16:27 <_austin> Hi all, bit of a Python question more than a BBB question but this would be the spot to ask I bet.  I want to start a timer based off an input on my BBB and have it increment until I tell it to stop.  I'd also like to be able to decrement the timer.  Any slick ideas?  I was going to use perf_counter() but it seems that's going to get a bit Feb 18 21:16:34 <_austin> tricky. Feb 18 21:25:58 <_austin> zmatt this is what we talked about the other day starting a timer to estimate pulses, was hoping there'd be a timer.start/timer.pause/timer.clear that i could use Feb 18 21:59:26 hi, I would like to get help how to program spi driver on beaaglebone enhanced. I cannot receive what I send in loopback mode. Any idea how to make it work ? Feb 18 22:01:32 <_austin> do you have a pastebin of the code snippet you're trying to get working? Feb 18 22:04:02 here it is : Feb 18 22:04:05 static void pabort(const char *s) Feb 18 22:04:06 { Feb 18 22:04:06     perror(s); Feb 18 22:04:07     abort(); Feb 18 22:04:07 } Feb 18 22:04:08 static const char *device = "/dev/spidev1.0"; Feb 18 22:04:08 static uint8_t mode; Feb 18 22:04:09 static uint8_t bits = 8; Feb 18 22:04:09 static uint32_t speed = 500000; Feb 18 22:04:10 static uint16_t delay; Feb 18 22:04:10 static void transfer(int fd) Feb 18 22:04:11 { Feb 18 22:04:12     int ret; Feb 18 22:04:12     uint8_t tx[] = { Feb 18 22:04:12         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, Feb 18 22:04:13         0x40, 0x00, 0x00, 0x00, 0x00, 0x95, Feb 18 22:04:13         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, Feb 18 22:04:14         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, Feb 18 22:04:25 } Feb 18 22:04:26 static void print_usage(const char *prog) Feb 18 22:04:26 { Feb 18 22:04:27     printf("Usage: %s [-DsbdlHOLC3]\n", prog); Feb 18 22:04:27     puts("  -D --device   device to use (default /dev/spidev1.1)\n" Feb 18 22:04:28          "  -s --speed    max speed (Hz)\n" Feb 18 22:04:28          "  -d --delay    delay (usec)\n" Feb 18 22:04:29          "  -b --bpw      bits per word \n" Feb 18 22:04:29          "  -l --loop     loopback\n" Feb 18 22:04:30          "  -H --cpha     clock phase\n" Feb 18 22:04:30          "  -O --cpol     clock polarity\n" Feb 18 22:04:31          "  -L --lsb      least significant bit first\n" Feb 18 22:04:31          "  -C --cs-high  chip select active high\n" Feb 18 22:04:32          "  -3 --3wire    SI/SO signals shared\n"); Feb 18 22:04:32     exit(1); Feb 18 22:04:33 } Feb 18 22:04:33 static void parse_opts(int argc, char *argv[]) Feb 18 22:04:34 { Feb 18 22:04:45             device = optarg; Feb 18 22:04:46             break; Feb 18 22:04:46         case 's': Feb 18 22:04:47             speed = atoi(optarg); Feb 18 22:04:47             break; Feb 18 22:04:48         case 'd': Feb 18 22:04:48             delay = atoi(optarg); Feb 18 22:04:49             break; Feb 18 22:04:49         case 'b': Feb 18 22:04:50             bits = atoi(optarg); Feb 18 22:04:50             break; Feb 18 22:04:51         case 'l': Feb 18 22:04:52             mode |= SPI_LOOP; Feb 18 22:04:52             break; Feb 18 22:04:52         case 'H': Feb 18 22:04:53             mode |= SPI_CPHA; Feb 18 22:04:53             break; Feb 18 22:04:54         case 'O': Feb 18 22:05:05 } Feb 18 22:05:06 int main(int argc, char *argv[]) Feb 18 22:05:08 { Feb 18 22:05:08     int ret = 0; Feb 18 22:05:08     int fd; Feb 18 22:05:08     parse_opts(argc, argv); Feb 18 22:05:08     fd = open(device, O_RDWR); Feb 18 22:05:09     if (fd < 0) Feb 18 22:05:09         pabort("can't open device"); Feb 18 22:05:10     /* Feb 18 22:05:10      * spi mode Feb 18 22:05:11      */ Feb 18 22:05:11     ret = ioctl(fd, SPI_IOC_WR_MODE, &mode); Feb 18 22:05:12     if (ret == -1) Feb 18 22:05:12         pabort("can't set spi mode"); Feb 18 22:05:13     ret = ioctl(fd, SPI_IOC_RD_MODE, &mode); Feb 18 22:05:13     if (ret == -1) Feb 18 22:05:14         pabort("can't get spi mode"); Feb 18 22:05:25     close(fd); Feb 18 22:05:26     return ret; Feb 18 22:05:26 } Feb 18 22:05:33 command line is empty i am using default /dev/spidev1.1 Feb 18 22:06:04 I shorted spi1_mosi with spi1_miso Feb 18 22:06:54 or spi1_di with spi1_do Feb 18 22:09:35 popadirka: Stop spammin' and use a paste service. Feb 18 22:10:23 I did paste Feb 18 22:10:45 Where? Feb 18 22:10:50 Where did you paste it? Feb 18 22:10:56 Show the link. Feb 18 22:10:59 in dialog box Feb 18 22:11:05 Right. spam Feb 18 22:11:09 Use pastebin.com Feb 18 22:11:16 That is one paste service. Feb 18 22:14:04 OK Feb 18 22:14:11 let me do it Feb 18 22:15:08 Okay. I will wait. Feb 18 22:16:37 https://pastebin.com/NniaxsBf Feb 18 22:16:58 Can you open it ? Feb 18 22:17:24 Yes. Feb 18 22:17:29 Is that from Molloy's book? Feb 18 22:17:35 yes Feb 18 22:17:50 Okay. Feb 18 22:17:53 slight modification Feb 18 22:17:56 So, look in the source. Do you see anything that resembles what you are doing? Feb 18 22:18:01 Oh. Feb 18 22:18:06 What did you change? Feb 18 22:18:44 spidev1 is not going to work if you have a Cape installed. Feb 18 22:18:52 Did you add the overlay? Feb 18 22:18:54 set cs_change to 0 Feb 18 22:19:10 Okay. I see you are using spidev1.0. Feb 18 22:19:17 Is that what you altered? Feb 18 22:19:25 yes Feb 18 22:19:35 I was trying to make it work Feb 18 22:20:05 Oh. So, you have CIPO and COPI shorted and at spidev1.0? Feb 18 22:20:26 CIPO is controller in/peripheral out. Feb 18 22:20:53 you mean mosi- to miso or di-do ? Feb 18 22:21:38 yes shorted Feb 18 22:21:47 Right. CIPO is the new naming resolution from the OSHWA. Feb 18 22:21:57 input to output Feb 18 22:22:16 Okay. So, what pins are you using to short them and did you add the overlay? Feb 18 22:22:59 e.g. p9.23 && p8.45 and etc. Feb 18 22:23:35 I connected oscilloscope to cs0 and sclk and trigger on cs0 and cs0 never become active , I do not see any triggering events running spidev_test Feb 18 22:24:17 P928 and P929? Feb 18 22:24:36 Okay. So, maybe the source needs to be changed to help you better see this on the o-scope. Feb 18 22:24:47 Oh and use an overlay. Feb 18 22:24:57 p9-29 to p9-30 Feb 18 22:25:21 Okay. Let me go and look those up. So, those are the two pins you shorted, right? Feb 18 22:25:34 yes Feb 18 22:26:01 One is 1.0 and one is 1.1. Can that still work? Feb 18 22:26:13 Hmm. I never tested that out. Feb 18 22:26:30 none 1.0 and 1,.1 worked for me Feb 18 22:26:40 I know I get boring but there is a reason. Feb 18 22:27:04 So, the source compiles and there is not an overlay? Feb 18 22:27:40 I would use 0.0 but you are free to use whatever one you would like. Maybe that will help? Feb 18 22:27:57 I need connect another  device to spi but Feb 18 22:28:54 Okay. So, you can use spidev_test. Have you altered any of the source for the spi device you are using, i.e. 0.0 or 0.1 or 1.0 or 1.1? Feb 18 22:29:20 Try to alter it, recompile it, and then report back please. Feb 18 22:29:36 I did connect also p9.18 to p9.17  with same result. Feb 18 22:29:45 I do not need to recompile Feb 18 22:29:56 Yes. w/ build Feb 18 22:29:58 popadirka: have you configured the pins you're using to spi mode? Feb 18 22:30:04 I need to run with --device /dev/spidev0.0 Feb 18 22:30:47 I suspect it is by default Feb 18 22:30:52 popadirka: they are not Feb 18 22:31:00 that is why I am using spi1 Feb 18 22:31:16 here's a quick SPI tutorial on the BBB: https://pastebin.com/nS6FELGH Feb 18 22:31:27 Ooh. Off to look! Feb 18 22:31:30 and use option 2 Feb 18 22:32:03 I'm not sure why I listed using an overlay as option 1, it should be the last option if anything Feb 18 22:32:30 I will try and get back. Feb 18 22:32:45 But anyway thatnks Feb 18 22:32:48 Nice... Feb 18 22:32:50 using spi1 insteadof spi0 is similar but also requires disabling (hdmi-)audio in /boot/uEnv.txt Feb 18 22:32:52 Good stuff. Feb 18 22:32:56 since the pins conflict with that Feb 18 22:33:02 Aw. Feb 18 22:33:11 Good info. Feb 18 22:33:53 popadirka: the tutorial uses python as example but you can of course use C code instead Feb 18 22:35:27 I was wondering why my spidev_test source from Molloy's book did not work on spidev1.0. Now, I know! Feb 18 22:35:32 hdmi! Feb 18 22:36:25 I disabled hdmi from uEnv.txt Feb 18 22:37:16 Man. Some people just want info. and answers. I guess that is normal. Feb 18 22:37:33 'Sign me up for you soul.' Ha. Feb 18 23:29:21 Mars! Feb 18 23:29:42 https://www.youtube.com/watch?v=9OCxouQGnns <<< Live! Feb 18 23:46:53 set_: have you seen this image of water on mars? http://4.bp.blogspot.com/-Bu8P0B1xnjc/UGdhrDd--YI/AAAAAAAAJgI/sXrkBKrbWX8/s1600/waterOnMars.jpg Feb 18 23:48:47 No. I was unware of that photo. Feb 18 23:48:50 Off to look at it. Feb 18 23:49:06 Ha. Feb 18 23:49:13 I think I have some glasses just like that one Feb 18 23:49:45 I think the image was originally posted by some jokesters at NASA Feb 18 23:50:05 Those people landed on Mars and landed well. They are going to update the source on the rover from the Earth to Mars. Nice. Feb 18 23:50:17 I do not understand. Feb 18 23:50:27 How can they update the source from that far away? Feb 18 23:51:26 you mean software updates? why would it matter if something is far away, as long as you can communicate? Feb 18 23:52:01 Yes. Feb 18 23:52:20 And...I guess you are right. Satelite? Feb 18 23:52:37 you just need to be extra careful since you can't go and fix it if you brick it Feb 18 23:52:46 indeed Feb 18 23:52:58 Right. Feb 18 23:53:00 And... Feb 18 23:53:10 The thing, the 'rover' can fly! Feb 18 23:53:14 some of the systems I work on are installed in hard to access places, but nothing quite that bad Feb 18 23:53:23 at worst, it's a helicopter ride away Feb 18 23:53:23 Ha. Feb 18 23:53:30 Oh. Feb 18 23:53:50 Scott Manley has a video about how the SOHO spacecraft was recovered after a failure: https://www.youtube.com/watch?v=k06c_87A74o Feb 18 23:54:21 including a software update to allow it to operate without its gyros (which had failed) Feb 18 23:54:26 there's obviously a lot of redundancy in those systems Feb 19 00:05:57 Nice. Feb 19 00:07:49 Now...NASA and other space agencies just need to fly that 'rover' around and take some COLOR photos. Finally! Feb 19 00:24:58 Right... and starship can go to mars immediately. Feb 19 01:40:51 GenTooMan: They, the people on this project, have color photos and video for the first time. Feb 19 01:43:32 Hey GenTooMan: Do you think porting this to the AI would work, i.e. https://www.hackster.io/functt/flir-lepton-beaglebone-green-and-lcd-displays-07ca4b ? Feb 19 01:45:49 I need to research the peripherals on the AI but off to check. Feb 19 02:05:52 Is there a spidev3.0 .dts on the AI yet? Feb 19 02:08:25 I will say no. Feb 19 02:08:34 No .dts file for am5729. Feb 19 02:08:59 +lorforlinux[m]: Are you still messing w/ those overlays for the AI? Feb 19 02:13:15 I found a 'virtualCape for BONE-SPI0_0.dts Feb 19 02:13:26 How do you build them again...? Feb 19 02:20:38 w/ your scripts or in another way? Feb 19 02:23:10 The ai has so many modes and 'balls' and and and. Feb 19 02:23:22 Why is this not getting air play like the BBB? Feb 19 02:23:42 It almost have unlimited config. options. Feb 19 02:23:59 'Pick and choose your mode wisely!' Feb 19 02:24:00 Ha. Feb 19 02:24:52 Plus it is 1.5 *'s faster w/ the CPU, i.e. am5729. Feb 19 02:25:09 And there are two of them... Feb 19 02:25:22 Anyway. Trying here. I will keep it up. Feb 19 02:53:10 set_ the lesson learned in the project was using the gyros actually made the thing dysfunctional. Feb 19 02:53:25 What are you talking about, sir? Feb 19 02:53:31 what gyros? Feb 19 02:53:45 Oh. From @zmatt's link? Feb 19 02:53:46 set_ SOHO satellite Feb 19 02:54:00 Oh. I did not look it over. Feb 19 02:54:07 I was busy w/ the live broadcast. Feb 19 02:54:20 Mars in color coming to you and soon! Feb 19 02:54:47 Even NASA loves some drawbacks. Feb 19 02:54:49 set_ it's called the RED planet for a reason Feb 19 02:54:55 Ha. Feb 19 02:55:02 Red Dirt! Feb 19 02:55:43 Right but there has not been a camera enabled device on that planet that can send in real time photos and video from the cam. in color. Feb 19 02:55:56 That was my point. Feb 19 02:56:13 set_ do you know and understand why that is? Feb 19 02:56:20 No sir. Feb 19 02:56:43 But...I guess it must have to do w/ pressure and an equillibrium? Feb 19 02:57:20 My camera ears just popped. Feb 19 02:57:24 real time video takes a lot of bandwidth, bandwidth takes a lot of power, so they need something to relay the data back to earth and a fast enough speed. Likely they were take video and transmit it as necessary Feb 19 02:57:48 Oh. Feb 19 02:57:49 Okay. Feb 19 02:58:18 So, b/c of the power consumption, live feeds in color have not been possible until now? Feb 19 02:58:48 Well, it is now is all I know and it is exciting. Feb 19 02:59:00 set_ that's the some and total of the problem in fact it's always power that is an issue with such systems. Feb 19 02:59:21 Oh. Right. B/c they will want it back if possible. Feb 19 02:59:29 It has to make it back? **** ENDING LOGGING AT Fri Feb 19 02:59:57 2021