James Skitt avatar James Skitt committed e7667e2 Merge

Merged intelligentagent/replicape into master

Comments (0)

Files changed (14)

 
 
 RPATH=/home/root/Replicape
-REMOTE=root@10.24.2.129
+REMOTE=root@10.24.2.124
 
 
 .PHONY : software firmware
 
 eeprom:
 	scp tools/replicape.json tools/eeprom_upload.py Makefile $(REMOTE):$(RPATH)/eeprom
-	ssh $(REMOTE) 'cd Replicape/eeprom; make eeprom_upload'
+	ssh $(REMOTE) 'cd Replicape/eeprom; make eeprom_cat'
 
 eeprom_upload: 
 	node ./eeprom.js -w replicape.json
 
 eeprom_cat:
 	node ./eeprom.js -w replicape.json
-	cat Replicape.eeprom > /sys/bus/i2c/drivers/at24/3-0050/eeprom
+	cat Replicape.eeprom > /sys/bus/i2c/drivers/at24/3-0055/eeprom
 
 software:
 	scp software/*.py $(REMOTE):$(RPATH)/software
 	scp -r PRU/PyPRUSS $(REMOTE):$(RPATH)/libs/
 	ssh $(REMOTE) 'cd $(RPATH)/libs/PyPRUSS; make && make install'
 
+
+tests:
+	scp -r software/tests $(REMOTE):$(RPATH)/software/

Binary file modified.

Binary file modified.

Add a comment to this file

PCB_rev1/Replicape_BOM_rev1.xlsx

Binary file modified.

PCB_rev1/changelog_PCB_rev_1.txt

  - Switched channels for ADC on Ext1 and Ext2?
  - Switched +5V and SYS_5V.
 
+
+Changelog Rev 1 -> Rev 2
+========================
+ - Missing R38, R39, 4.7K 0402
+ - Make all 0.1uF caps same size
+ - Missing 3 5.6K resistors
+ - Missing 3 end-stop connetors
+ - Wrong comparator, swich to LM339-14SOIC
+

firmware/Makefile

 
-COMPILER=../../PyPRUSS/PASM/pasm -b 
+COMPILER=../libs/PyPRUSS/PASM/pasm -b 
 FILENAME=firmware_pru_0
 
 .PHONY: clean all

firmware/firmware_pru_0.p

 #define GPIO_DATAOUT 		0x13c				// This is the register for setting data
 #define DDR_MAGIC			0xbabe7175			// Magic number used to reset the DDR counter 
 #define GPIO1 				0x4804C000			// The adress of the GPIO1 bank
-#define GPIO2 				0x481AC000	 		// The adress of the GPIO2 bank
 #define GPIO3 				0x481AE000 			// The adress of the GPIO3 bank 
-#define GPIO1_MASK			(1<<13)|(1<<12)|(1<<30)|(1<<31)|(1<<1)	// Only these two pins are togglable
-#define GPIO2_MASK			(1<<2)
-#define GPIO3_MASK			(1<<19)|(1<<21)		// Only these two pins are togglable
+#define GPIO1_MASK			(1<<1)|(1<<2)|(1<<6)|(1<<7)|(1<<12)|(1<<13)|(1<<14)|(1<<30)|(1<<31) // Toggelable
+#define GPIO3_MASK			(1<<21)		// Only these two pins are togglable
 
 START:
     LBCO r0, C4, 4, 4							// Load Bytes Constant Offset (?)
 	MOV  r10, GPIO1_MASK						// Make the mask
     MOV  r11, GPIO1 | GPIO_DATAOUT				// Load address
     MOV  r12, 0xFFFFFFFF ^ (GPIO1_MASK)			// Invert the mask
-	MOV  r13, GPIO2_MASK						// Make the mask
-    MOV  r14, GPIO2 | GPIO_DATAOUT				// Load address 
-    MOV  r15, 0xFFFFFFFF ^ (GPIO2_MASK)			// Invert mask
 	MOV  r16, GPIO3_MASK						// Make the mask
     MOV  r17, GPIO3 | GPIO_DATAOUT				// Load address
     MOV  r18, 0xFFFFFFFF ^ (GPIO3_MASK)			// Invert mask
     SBBO r3, r11, 0, 4							// Ok, set the pins
 
     LBBO r2, r4, 0, 4							// Load pin data into r2
-	AND  r2, r2, r13							// Mask the pins to GPIO2
-	LBBO r3, r14, 0, 4							// Load the data currently in addr r3
-	AND	 r3, r3, r15							// Mask the data so only the necessary pins can change
-	OR   r3, r3, r2 							// Add the GPIO2-mask to hinder toggling PRU1's pins
-    SBBO r3, r14, 0, 4							// Ok, set the pins
-
-    LBBO r2, r4, 0, 4							// Load pin data into r2
 	AND  r2, r2, r16							// Mask the pins to GPIO3
 	LBBO r3, r17, 0, 4							// Load the data currently in addr r3
 	AND	 r3, r3, r18							// Mask the data so only the necessary pins can change

libs/spi/spimodule.c

 
 static int __SPI_set_mode( int fd, __u8 mode) {
 	__u8 test;
-	printf("setmode called with mode = %x\n", mode);
+	//printf("setmode called with mode = %x\n", mode);
 	if (ioctl(fd, SPI_IOC_WR_MODE, &mode) == -1) {
 		PyErr_SetFromErrno(PyExc_IOError);
 		return -1;
 	__SPI_set_mode(self->fd, tmp);
 
 	self->mode = tmp;
-	printf("mode now: %x\n", self->mode);
+	//printf("mode now: %x\n", self->mode);
 	return 0;
 }
 
 	__SPI_set_mode(self->fd, tmp);
 
 	self->mode = tmp;
-	printf("mode now: %x\n", self->mode);
+	//printf("mode now: %x\n", self->mode);
 	return 0;
 }
 
 	__SPI_set_mode(self->fd, tmp);
 
 	self->mode = tmp;
-	printf("mode now: %x\n", self->mode);
+	//printf("mode now: %x\n", self->mode);
 	return 0;
 }
 
 	__SPI_set_mode(self->fd, tmp);
 
 	self->mode = tmp;
-	printf("mode now: %x\n", self->mode);
+	//printf("mode now: %x\n", self->mode);
 	return 0;
 }
 
 	__SPI_set_mode(self->fd, tmp);
 
 	self->mode = tmp;
-	printf("mode now: %x\n", self->mode);
+	//printf("mode now: %x\n", self->mode);
 	return 0;
 }
 

software/Path_planner.py

                 if "Z" in all_data:     # HACK! The Z-axis cannot be combined with the other data. Somehow it goes backwards...
                     packet = all_data["Z"]      
                     while not self.pru.has_capacity_for(len(packet[0])*8):# Wait until the PRU has capacity for this chunk of data
-                        #print "PRU does not have capacity for "+str(len(packet[0])*8),
-                        #print "only has "+str(self.pru.get_capacity())
                         time.sleep(1)                   
                     if self.pru.add_data(packet) > 0:                        
                         self.pru.commit_data() 
     def has_capacity_for(self, data_len):
         with self.ddr_lock:
             cap = self.ddr_size-self.ddr_mem_used
-        return (cap > data_len) 
+        return (cap/2.0 > data_len) 
 
     ''' Check if the PRU has capacity for a chunk of data '''
     def get_capacity(self):
 
         self.ddr_end = self.ddr_start+len(data)       
         if self.ddr_end >= self.DDR_END-16:                     # If the data is too long, wrap it around to the start
-            print "self.ddr_end >= self.DDR_END-16"
             multiple = (self.DDR_END-self.ddr_start)%8          # Find a multiple of 8
             cut = self.DDR_END-self.ddr_start-multiple-4-8      # The cut must be done after a delay, so a multiple of 8 bytes +/-4
         
                 self.ddr_end = self.DDR_START+4
                 self.ddr_mem[self.DDR_START:self.DDR_START+4] = struct.pack('L', 0) # Terminate the first word
                 self.debug = 2
-                print "\tSecond batch skipped, 0 length"
-                print "\tremaining data "+str(data[cut:])
-            
-            print "Wrapped. Capacity is now "+str(self.get_capacity())
+                print "\tSecond batch skipped, 0 length"            
         else:
-            if self.debug > 0:
-                 print "Laying out from "+hex(self.ddr_start)+" to "+hex(self.ddr_end)
-                 print "self.ddr_end = "+hex(self.ddr_end)
-                 print "self.DDR_END = "+hex(self.DDR_END)
-            self.ddr_mem[self.ddr_start:self.ddr_end] = data    # Write the data to the DDR memory.
+            self.ddr_mem[self.ddr_start:self.ddr_end] = data    # Write the data to the DDR memory. 
             with self.ddr_lock:
-                self.ddr_mem_used += len(data)
+                self.ddr_mem_used += len(data)               
             self.ddr_used.put(len(data)) 		            # update the amount of memory used 
+            if self.debug > 0:
+                 print "Pushed "+str(len(data))+" from "+hex(self.ddr_start)+" to "+hex(self.ddr_end)
+            
 
         self.ddr_start 		= self.ddr_end-4                    # Update the start of ddr for next time 
         self.pru_data 		= []                                # Reset the pru_data list since it has been commited         
         inst_pr_step = (int(s/self.s_pr_inst_2)-self.inst_pr_loop)/self.inst_pr_delay
         if inst_pr_step < 1:
             inst_pr_step = 1
+        if inst_pr_step == 0xbabe7175:
+            print "\tInst pr step is BABETITS!!!"
+            inst_pr_step = 0xbabe7175-1
         return inst_pr_step
 
     ''' Braid/merge together the data from the two data sets'''

software/Replicape.py

         self.steppers = {}
 
         # Init the 5 Stepper motors
-        self.steppers["X"]  = SMD(io.GPIO1_12, io.GPIO1_13, io.GPIO1_7,  7, "X")  # Fault_x should be PWM2A?
+        self.steppers["X"]  = SMD(io.GPIO1_12, io.GPIO1_13, io.GPIO2_4,  5, "X")  # Fault_x should be PWM2A?
         self.steppers["Y"]  = SMD(io.GPIO1_31, io.GPIO1_30, io.GPIO1_15, 1, "Y")  
-        self.steppers["Z"]  = SMD(io.GPIO1_1,  io.GPIO2_2,  io.GPIO0_27, 2, "Z")  
-        self.steppers["E"]  = SMD(io.GPIO3_21, io.GPIO3_19, io.GPIO2_3,  4, "Ext1")
+        self.steppers["Z"]  = SMD(io.GPIO1_1,  io.GPIO1_2,  io.GPIO0_27, 2, "Z")  
+        self.steppers["E2"]  = SMD(io.GPIO3_21, io.GPIO1_7, io.GPIO2_1,  3, "Ext1")
+        self.steppers["E"]  = SMD(io.GPIO1_14, io.GPIO1_6, io.GPIO2_3,  4, "Ext2")
 
         # Enable the steppers and set the current, steps pr mm and microstepping  
-        self.steppers["X"].setCurrentValue(2.0) # 2A
+        self.steppers["X"].setCurrentValue(1.0) # 2A
         self.steppers["X"].setEnabled() 
         self.steppers["X"].set_steps_pr_mm(6.105)         
         self.steppers["X"].set_microstepping(2) 
 
-        self.steppers["Y"].setCurrentValue(2.0) # 2A
+        self.steppers["Y"].setCurrentValue(1.0) # 2A
         self.steppers["Y"].setEnabled() 
         self.steppers["Y"].set_steps_pr_mm(5.95)
         self.steppers["Y"].set_microstepping(2) 
         self.steppers["Z"].set_steps_pr_mm(155)
         self.steppers["Z"].set_microstepping(2) 
 
-        self.steppers["E"].setCurrentValue(1.8) # 2A        
+        self.steppers["E"].setCurrentValue(1.0) # 2A        
         self.steppers["E"].setEnabled()
         self.steppers["E"].set_steps_pr_mm(5.0)
         self.steppers["E"].set_microstepping(2)
     def setCurrentValue(self, iChop):        
         vRef = 3.3                              # Voltage reference on the DAC
         rSense = 0.1                            # Resistance for the 
-        vOut = iChop*5.0*rSense                 # Calculated voltage out from the DAC (See page 9 in the datasheet for the DAC)
+        vOut = iChop*5.0*rSense                 # Calculated voltage out from the DAC 
 
         self.dacval = int((vOut*256.0)/vRef)
-        byte1 = ((self.dacval & 0xF0)>>4) + (self.dac_channel<<4)
+        byte1 = ((self.dacval & 0xF0)>>4) | (self.dac_channel<<4)
         byte2 = (self.dacval & 0x0F)<<4
         spi2_0.writebytes([byte1, byte2])       # Update all channels
         spi2_0.writebytes([0xA0, 0xFF])         # TODO: Change to only this channel (1<<dac_channel) ?
 
+
     ''' Returns the current state '''
     def getState(self):
         return self.state & 0xFF				# Return the satate of the serial to parallel

tools/eeprom_upload.py

 import os as os
 
 filename ="Replicape.eeprom" 
-eeprom_addr = "0x50"
+eeprom_addr = "0x54"
 with open(filename, 'r') as f:	
 	for i, ch in enumerate(f.read()):
 		cmd = "i2cset -y 3 "+eeprom_addr+" "+hex(i)+" 0x"+ch.encode("hex")
-		print cmd
 		os.system(cmd)

tools/replicape.json

  "Replicape.eeprom": {
     "type": "cape",
     "header": "aa5533ee",
-    "formatRev": "0",
+    "formatRev": "1",
     "boardName": "Replicape 3D printer cape",
-    "version": "0",
+    "version": "1",
     "manufacturer": "Elias Bakken",
     "partNumber": "BB-REPLICAPE-01",
-    "numPins": 18,
+    "numPins": 29,
     "serialNumber": "00000000001",
     "currentVDD_3V3EXP": 40,
     "currentVDD_5V": 0,
         "mode": 7,
         "function": "gpio1_28"
       },     
- 	  "P9_14": {
-        "used": "used",
-        "direction": "out",
-        "pullup": "pulldown",
-        "rx": "disabled",
-        "mode": 6,
-        "function": "ehrpwm1A_mux1"
-      },	
-      "P9_15": {
+	  "P9_13": {
         "used": "used",
         "direction": "in",
         "pullup": "pullup",
         "rx": "disabled",
         "mode": 7,
-        "function": "gpio1_16"
-      },
-      "P9_16": {
-        "used": "used",
-        "direction": "out",
-        "pullup": "pulldown",
-        "rx": "disabled",
-        "mode": 6,
-        "function": "ehrpwm1B_mux1"
-      },	
-
-      "P9_23": {
+        "function": "gpio0_31"
+	  },     
+      "P9_17": {
         "used": "used",
         "direction": "in",
         "pullup": "pullup",
         "rx": "disabled",
-        "mode": 6,
-        "function": "ehrpwm1B_mux1"
-      },
-      "P9_25": {
+        "mode": 7,
+        "function": "GPIO0_5"
+      },	
+       "P9_22": {
         "used": "used",
         "direction": "out",
         "pullup": "pullup",
         "rx": "disabled",
-        "mode": 7,
-        "function": "gpio3_21"
+        "mode": 3,
+        "function": "ehrpwm0A"
       },
-      "P9_27": {
+      "P9_25": {
         "used": "used",
         "direction": "out",
         "pullup": "pullup",
         "rx": "disabled",
         "mode": 7,
-        "function": "gpio3_19"
+        "function": "gpio3_21"
       },
       "P9_28": {
         "used": "used",
         "direction": "in",
         "slew": "fast",
         "rx": "disabled",
-        "pullup": "pullup",
+        "pullup": "disabled",
         "mode": 7,
         "function": "gpio1_6"
 	  },
       "P8_4": {
         "used": "used",
-        "direction": "in",
-        "slew": "fast",
+        "direction": "out",
         "rx": "disabled",
         "pullup": "disabled",
         "mode": 7,
         "mode": 7,
         "function": "gpio1_2"
 	  },
-      "P8_6": {
+      "P8_8": {
         "used": "used",
         "direction": "in",
         "slew": "fast",
         "rx": "disabled",
-        "pullup": "disabled",
+        "pullup": "pullup",
+        "mode": 7,
+        "function": "gpio2_3"
+	  },
+      "P8_10": {
+        "used": "used",
+        "direction": "in",
+        "slew": "fast",
+        "rx": "disabled",
+        "pullup": "pullup",
         "mode": 7,
-        "function": "gpio1_3"
+        "function": "gpio2_4"
 	  },
       "P8_11": {
         "used": "used",
         "direction": "in",
         "slew": "fast",
         "rx": "disabled",
-        "pullup": "disabled",
+        "pullup": "pullup",
         "mode": 7,
         "function": "gpio1_15"
 	  },
       "P8_16": {
         "used": "used",
-        "direction": "in",
-        "slew": "fast",
+        "direction": "out",
         "rx": "disabled",
         "pullup": "disabled",
         "mode": 7,
         "direction": "in",
         "slew": "fast",
         "rx": "disabled",
-        "pullup": "disabled",
+        "pullup": "pullup",
         "mode": 7,
         "function": "gpio0_27"
 	  },
         "direction": "in",
         "slew": "fast",
         "rx": "disabled",
-        "pullup": "disabled",
+        "pullup": "pullup",
         "mode": 7,
         "function": "gpio2_1"
 	  },
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.