Commits

Elias Bakken  committed 4c34d2f

First commit after makeing it work for Rev 1.

  • Participants
  • Parent commits 7933058

Comments (0)

Files changed (11)

 
 
 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/

File PCB_rev1/Replicape.brd

Binary file modified.

File PCB_rev1/Replicape.sch

Binary file modified.

File 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
+

File firmware/Makefile

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

File 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

File 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;
 }
 

File 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)

File software/Smd.py

     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

File 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)

File 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"
 	  },