03-18-2015, 10:16 PM
|
#1771 (permalink)
|
Master EcoModder
Join Date: Oct 2012
Location: USA
Posts: 1,408
Thanks: 102
Thanked 252 Times in 204 Posts
|
here are the output files using xc16 from the original instructables sources, in the latest mplab (on ubuntu).
|
|
|
Today
|
|
|
Other popular topics in this forum...
|
|
|
03-19-2015, 07:29 AM
|
#1772 (permalink)
|
Dreamer
Join Date: Nov 2013
Location: Australia
Posts: 350
Thanks: 95
Thanked 214 Times in 151 Posts
|
Quote:
Originally Posted by P-hack
here are the output files using xc16 from the original instructables sources, in the latest mplab (on ubuntu).
|
I had a try at this but received errors during the build. Most likely due to the way i setup MplabX. Until now i have only used the XC8 compiler with my other projects so i may not have added in the XC16 compiler correctly.
Any chance you could post a link to an archive of the project folder? I just want to eliminate the chance that i missed adding a file or put them in the wrong folders.
|
|
|
03-19-2015, 08:10 AM
|
#1773 (permalink)
|
Master EcoModder
Join Date: Oct 2012
Location: USA
Posts: 1,408
Thanks: 102
Thanked 252 Times in 204 Posts
|
yah you will need xc16 for the 16 bit mcu.
here is the zipped project folder (with .xls added due to upload limits on .zip, remove it from the filename)
THIS IS A STATIC SNAPSHOT, make no assumptions about how current it is, like the above, the intent was to test some hardware with the xc16 compiler BEFORE having to sort out the hundreds of megs of install, but hopefully it will help too. The code is surely out of date.
edit, sorry bout the contest paul. here are the finalists if anyone is interested:
MAKE ENERGY: A US-Mexico Innovation Challenge
lots of mediocre, the bioconverters are kinda interesting, liked the Vapour TorQ heat engine. Am pissed the hho cell made the list (Celda seca de hidrógeno) :/ seriously, wtf?
edit, this doesn't have sources in it :/ will try a different folder.
Last edited by P-hack; 03-19-2015 at 11:41 AM..
|
|
|
The Following User Says Thank You to P-hack For This Useful Post:
|
|
03-19-2015, 11:03 AM
|
#1774 (permalink)
|
Dreamer
Join Date: Nov 2013
Location: Australia
Posts: 350
Thanks: 95
Thanked 214 Times in 151 Posts
|
Quote:
Originally Posted by P-hack
yah you will need xc16 for the 16 bit mcu.
here is the zipped project folder (with .xls added due to upload limits on .zip, remove it from the filename)
|
I couldn't successfully add that folder as a project. I think it is because it is getting late and my brain went to bed a couple of hours ago.
I will tackle it again tomorrow.
|
|
|
03-19-2015, 11:52 AM
|
#1775 (permalink)
|
Master EcoModder
Join Date: Oct 2012
Location: USA
Posts: 1,408
Thanks: 102
Thanked 252 Times in 204 Posts
|
Ah, the zip is the X folder, which doesn't have source. Will update from git later and try again.
|
|
|
03-22-2015, 07:28 PM
|
#1776 (permalink)
|
Master EcoModder
Join Date: Oct 2012
Location: USA
Posts: 1,408
Thanks: 102
Thanked 252 Times in 204 Posts
|
didn't see any changes in git, and I'm not sure how helpful this is (since I just changed some case names and a filename or two), and there seems to be an impedance mismatch between git and mplabx, so my files might seem like they are in a strange location. But attached are the sources I used on linux. I am not intending to fork anything here, just a snapshot in time.
Also the built files are in post 1771.
here is the clean/build log if it helps too:
PHP Code:
CLEAN SUCCESSFUL (total time: 70ms) make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf make[1]: Entering directory `/var/home/dave/Desktop/proj/mpcontroller/MPLABXProjects/mpcontrol.X' make -f nbproject/Makefile-default.mk dist/default/production/mpcontrol.X.production.hex make[2]: Entering directory '/var/home/dave/Desktop/proj/mpcontroller/MPLABXProjects/mpcontrol.X' "/var/progs/microchip/xc16/v1.24/bin/xc16-gcc" ../../ACInductionController/ACInductionController.c -o build/default/production/_ext/1746335589/ACInductionController.o -c -mcpu=30F4011 -MMD -MF "build/default/production/_ext/1746335589/ACInductionController.o.d" -g -omf=elf -O0 -msmart-io=1 -Wall -msfr-warn=off "/var/progs/microchip/xc16/v1.24/bin/xc16-gcc" ../../ACInductionController/UART4011.c -o build/default/production/_ext/1746335589/UART4011.o -c -mcpu=30F4011 -MMD -MF "build/default/production/_ext/1746335589/UART4011.o.d" -g -omf=elf -O0 -msmart-io=1 -Wall -msfr-warn=off "/var/progs/microchip/xc16/v1.24/bin/xc16-gcc" -o dist/default/production/mpcontrol.X.production.elf build/default/production/_ext/1746335589/ACInductionController.o build/default/production/_ext/1746335589/UART4011.o -mcpu=30F4011 -omf=elf -Wl,,--defsym=__MPLAB_BUILD=1,,--script=p30F4011.gld,--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="dist/default/production/mpcontrol.X.production.map",--report-mem
Program Memory [Origin = 0x100, Length = 0x7f00]
section address length (PC units) length (bytes) (dec) ------- ------- ----------------- -------------------- .text 0x100 0x170 0x228 (552) .const 0x270 0xff0 0x17e8 (6120) .text 0x1260 0x1a60 0x2790 (10128) .dinit 0x2cc0 0x174 0x22e (558)
Total program memory used (bytes): 0x43ce (17358) 35%
Data Memory [Origin = 0x800, Length = 0x800]
section address alignment gaps total length (dec) ------- ------- -------------- ------------------- .ndata 0x800 0 0x1ac (428) .nbss 0x9ac 0 0x188 (392) .ndata 0xb34 0 0x58 (88) .nbss 0xb8c 0 0x40 (64)
Total data memory used (bytes): 0x3cc (972) 47%
Dynamic Memory Usage
region address maximum length (dec) ------ ------- --------------------- heap 0 0 (0) stack 0xbcc 0x434 (1076)
Maximum dynamic memory (bytes): 0x434 (1076)
"/var/progs/microchip/xc16/v1.24/bin"/xc16-bin2hex dist/default/production/mpcontrol.X.production.elf -a -omf=elf make[2]: Leaving directory '/var/home/dave/Desktop/proj/mpcontroller/MPLABXProjects/mpcontrol.X' make[1]: Leaving directory `/var/home/dave/Desktop/proj/mpcontroller/MPLABXProjects/mpcontrol.X'
BUILD SUCCESSFUL (total time: 2s) Loading code from /var/home/dave/Desktop/proj/mpcontroller/MPLABXProjects/mpcontrol.X/dist/default/production/mpcontrol.X.production.hex... Loading completed
and here is the info from the mplabx dashboard for the project
PHP Code:
/var/home/dave/Desktop/proj/mpcontroller/MPLABXProjects/mpcontrol.X mpcontrol Project Type: Application - Configuration: default Device dsPIC30F4011 Checksum: 0xD1AE Compiler Toolchain XC16 (v1.24) [/var/progs/microchip/xc16/v1.24/bin] Production Image: Optimization: gcc 0 Memory Usage Symbols disabled. Click to enable Load Symbols. Data 2048 (0x800) bytes Program 16384 (0x4000) words Debug Tool PICkit2 Debug Resources Program BP Used: 0 Free: 2 Data BP Used: 0 Free: 2 Data Capture BP: No Support Unlimited BP (S/W): No Support
Other Project Info Data Reserved Memory Production Image Program Reserved Memory Production Image
Control Points.
Java NetBeans Properties MPLAB X IDE v2.30 - mpcontrol : default os.name : Linux os.arch : amd64 os.version : 3.13.0-32-generic sun.arch.data.model : 64 sun.java.command : org.netbeans.Main --userdir /home/dave/.mplab_ide/dev/v2.30 --branding mplab java.version : 1.7.0_67 java.vm.version : 24.65-b04 java.runtime.version : 1.7.0_67-b01 java.specification.version : 1.7 netbeans.user : /home/dave/.mplab_ide/dev/v2.30 netbeans.home : /var/progs/microchip/mplabx/mplab_ide/platform netbeans.projects.dir : /home/dave/MPLABXProjects java.io.tmpdir : /tmp user.home : /home/dave user.country : US user.language : en user.timezone : America/Chicago sun.jnu.encoding : UTF-8 file.encoding : UTF-8 file.separator : /
Java & System Memory Java Total Memory = 247 Mb Java Used Memory = 112 Mb Java Free Memory = 135 Mb CommittedVirtualMemorySize = 3770 Mb FreePhysicalMemorySize = 585 Mb MaxFileDescriptorCount = 0 Mb OpenFileDescriptorCount = 0 Mb ProcessCpuLoad = 0 Mb SystemCpuLoad = 0 Mb TotalPhysicalMemorySize = 3754 Mb
System Path PATH = /home/dave/bin:/var/progs/jdk/bin:/var/progs/adk/sdk/tools:/var/progs/adk/sdk/platform-tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/var/progs/microchip/xc8/v1.33/bin:/var/progs/microchip/xc16/v1.24/bin
so if you unzip this into directory /home/dave/Desktop/proj/mpcontroller the mplab project posted above should work as is, but I don't recommend it long term.
Last edited by P-hack; 03-22-2015 at 07:45 PM..
|
|
|
The Following User Says Thank You to P-hack For This Useful Post:
|
|
03-23-2015, 09:22 AM
|
#1777 (permalink)
|
Dreamer
Join Date: Nov 2013
Location: Australia
Posts: 350
Thanks: 95
Thanked 214 Times in 151 Posts
|
Well this is all strange.
I extracted those files to a folder in the mplabx projects directory.
Then in mplabx i created a new stand alone project using that folder.
Added the source and header files from the folder to the project.
Did a clean and build and hey presto it worked.
I hadn't changed anything else in mplabx so i am not sure what i was dong wrong before.
Code:
CLEAN SUCCESSFUL (total time: 51ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/jase/MPLABXProjects/ACInductionController'
make -f nbproject/Makefile-default.mk dist/default/production/ACInductionController.production.hex
make[2]: Entering directory `/home/jase/MPLABXProjects/ACInductionController'
"/opt/microchip/xc16/v1.24/bin/xc16-gcc" ACInductionController.c -o build/default/production/ACInductionController.o -c -mcpu=30F4011 -MMD -MF "build/default/production/ACInductionController.o.d" -g -omf=elf -O0 -msmart-io=1 -Wall -msfr-warn=off
"/opt/microchip/xc16/v1.24/bin/xc16-gcc" UART4011.c -o build/default/production/UART4011.o -c -mcpu=30F4011 -MMD -MF "build/default/production/UART4011.o.d" -g -omf=elf -O0 -msmart-io=1 -Wall -msfr-warn=off
"/opt/microchip/xc16/v1.24/bin/xc16-gcc" -o dist/default/production/ACInductionController.production.elf build/default/production/ACInductionController.o build/default/production/UART4011.o -mcpu=30F4011 -omf=elf -Wl,,--defsym=__MPLAB_BUILD=1,,--script=p30F4011.gld,--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="dist/default/production/ACInductionController.production.map",--report-mem
Program Memory [Origin = 0x100, Length = 0x7f00]
section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x100 0x170 0x228 (552)
.const 0x270 0xff0 0x17e8 (6120)
.text 0x1260 0x1a60 0x2790 (10128)
.dinit 0x2cc0 0x174 0x22e (558)
Total program memory used (bytes): 0x43ce (17358) 35%
Data Memory [Origin = 0x800, Length = 0x800]
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.ndata 0x800 0 0x1ac (428)
.nbss 0x9ac 0 0x188 (392)
.ndata 0xb34 0 0x58 (88)
.nbss 0xb8c 0 0x40 (64)
Total data memory used (bytes): 0x3cc (972) 47%
Dynamic Memory Usage
region address maximum length (dec)
------ ------- ---------------------
heap 0 0 (0)
stack 0xbcc 0x434 (1076)
Maximum dynamic memory (bytes): 0x434 (1076)
"/opt/microchip/xc16/v1.24/bin"/xc16-bin2hex dist/default/production/ACInductionController.production.elf -a -omf=elf
make[2]: Leaving directory `/home/jase/MPLABXProjects/ACInductionController'
make[1]: Leaving directory `/home/jase/MPLABXProjects/ACInductionController'
BUILD SUCCESSFUL (total time: 1s)
Loading code from /home/jase/MPLABXProjects/ACInductionController/dist/default/production/ACInductionController.production.hex...
Loading completed
Thank you P-hack.
Now i have a foundation for making any minor changes that the forum or Paul might come up with and building the hex file myself.
Paul does amazing work but it is nice to know that i can make minor changes myself.
I am not saying i will but it is nice to not feel reliant on Paul's generous nature.
|
|
|
03-23-2015, 10:43 AM
|
#1778 (permalink)
|
Dreamer
Join Date: Nov 2013
Location: Australia
Posts: 350
Thanks: 95
Thanked 214 Times in 151 Posts
|
Quote:
Originally Posted by thingstodo
High V side
Battery pack neg -> precharge resistor (with precharge contactor across it) -> B- on controller
Battery pack pos -> 80 amp DC braker -> primary contactor -> B+ on controller
|
thingstodo, i am not sure about the pre charge contactor set up you have described.
I had a quick look at Pauls code and it looks like the pre charge voltage is turned on, then after a 1 second delay the main contactor voltage is turned on. But then, after a further delay of 0.2 seconds the pre charge contactor voltage is removed.
This seems designed to work with something like circuit 2 below whereas your description sounds more like circuit 1.
Circuit 1 would require the main contactor close first. Controller charges through pre charge resistor. Then the pre charge contactor is closed and the main contactor stays closed. Both contactors must stay closed whilst the controller is driving the motor.
Circuit 2 has the pre charge contactor closing first. Controller charges. Then the main contactor closes. The pre charge contactor is now bypassed by the main contactor and so can be de energised (opened). Only the main contactor needs to remain closed while the controller is driving the motor.
If you have already wired your vehicle then the start up sequence could be changed in the controller software.
Remove the two lines that cause the pre charge contactor to open.
And swap the main and pre charge variables.
Before changes
Code:
O_LAT_PRECHARGE_RELAY = 1; // 1 means close the relay. Now the cap is filling up.
DelayTenthsSecond(10); // savedValues.prechargeTime);
// High pedal lockout. Wait until they aren't touching the throttle before closing the main contactor.
do {
ReadADInputs();
} while (ADThrottle < savedValues.minRegenPosition || ADThrottle > savedValues.minThrottlePosition); // I'm using a wig wag hall effect throttle.
O_LAT_CONTACTOR = 1; // close main contactor.
DelayTenthsSecond(2); // delay 0.2 seconds, to give the contactor a chance to close. Then, there will be no current going through the precharge relay.
O_LAT_PRECHARGE_RELAY = 0; // open precharge relay once main contactor is closed.
After changes
Code:
O_LAT_CONTACTOR = 1; // 1 means close the main relay. Now the cap is filling up.
DelayTenthsSecond(10); // savedValues.prechargeTime);
// High pedal lockout. Wait until they aren't touching the throttle before closing the main contactor.
do {
ReadADInputs();
} while (ADThrottle < savedValues.minRegenPosition || ADThrottle > savedValues.minThrottlePosition); // I'm using a wig wag hall effect throttle.
O_LAT_PRECHARGE_RELAY = 1; // close precharge contactor.
// DelayTenthsSecond(2); // delay 0.2 seconds, to give the contactor a chance to close. Then, there will be no current going through the precharge relay.
// O_LAT_PRECHARGE_RELAY = 0; // open precharge relay once main contactor is closed.
A disadvantage to running with a precharge circuit like circuit 1 is that both the pre charge and main contactors must be rated to carry the full traction current. Whereas with circuit 2 the pre charge only has to carry a fraction of the current and only for 1 second. So the pre charge contactor can be a much lower cost device.
Last edited by Astro; 03-23-2015 at 10:48 AM..
|
|
|
The Following User Says Thank You to Astro For This Useful Post:
|
|
03-23-2015, 12:31 PM
|
#1779 (permalink)
|
Master EcoModder
Join Date: Oct 2012
Location: USA
Posts: 1,408
Thanks: 102
Thanked 252 Times in 204 Posts
|
awesome you got it compiling (I hate being the only one ).
reminder the compiler has probably changed dramatically and the binaries still need hardware re-validation, as well as validating the optimization level is correct and operates the inverter hardware correctly.
|
|
|
03-24-2015, 12:26 AM
|
#1780 (permalink)
|
Master EcoModder
Join Date: Sep 2010
Location: Saskatoon, canada
Posts: 1,488
Thanks: 746
Thanked 565 Times in 447 Posts
|
Quote:
Originally Posted by Astro
thingstodo, i am not sure about the pre charge contactor set up you have described.
|
Paul showed me that the pre-charge circuit I have will not work with the controller as programmed.
I will change my circuit for testing to match circuit 2.
|
|
|
|