Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Printrboard RevF #3182

Merged

Conversation

thinkyhead
Copy link
Member

In answer to #2971 here's support for Printrboard RevF provided for us by @StephS and @Printrbot. This PR includes updates to bring the code up to date with the latest code-base.

Adapted from the Printrbot Marlin Rev F branch.

The Pins file for the RevF board is included.

For reference, Marlin currently assigns these codes for DIGIPOTSS and DIGITPOT_I2C:

  • M907 to set digital trimpot motor current using axis codes.
  • M908 to control digital trimpot directly.

The PrintrBoard Rev F utilizes a mcp4728 DAC to set the motor current. This PR includes Printrbot's M907 and M908 supporting DAC stepper current. If you are building for Printrbot, these codes will set and control stepper current through the mcp4728.

This PR also includes Printrbot's new M-codes to set and write the DAC settings to the DAC EEPROM:

  • M909 (Read DAC)
  • M910 (Write DAC)

If you are building for Printrbot Rev. F, these codes will be available to read and write DAC values.

The PrintrBoard Rev F utilizes a mcp4728 DAC to set motor current. Printrbot's implementation utilizes 2 new M-codes to set and write the DAC settings to the DAC EEPROM: `M909` (Read DAC) and `M910` (Write DAC). `M907` is re-used to set value, `M908` for direct control.

The Pins file for the RevF board is included.
@thinkyhead thinkyhead force-pushed the rcbugfix_printrboard_revf branch 4 times, most recently from db9ee09 to 994a4bc Compare March 20, 2016 02:13
@paulusjacobus
Copy link
Contributor

@StephS and @thinkyhead is the Printrbot Rev F a working version? I'm fixing a friend's Printrbot Simple 1403 and need to reflash the Atmel processor. The Printrbot site provides a firmware but the Y axis is inverted. My aim is to get a working firmware into the Printrbot by using DFU or Arduino IDE. I do have some issues here because of the environments (can't seem to add the Teensy libraries to my Arduino 1.6.5 version, the installer complains that it can't find the version.txt):

Checking Arduino 1.6.5-r5:
version: "lib/version.txt" file missing
Does not match Arduino 1.6.5-r5'

... and the installation of Teensy boards into the Arduino IDE breaks.

@StephS any how I can get that "version.txt"?

@thinkyhead
Copy link
Member Author

This is supposed to be all the same stuff that the Printrbot fork is using — that's all I know. I haven't been able to test building it yet, as I also don't have Teensy++ 2.0 support installed, and it's a slow connection here so I need to do the download overnight.

@paulusjacobus
Copy link
Contributor

I also don't have Teensy++ 2.0 support installed

Let me know if you succeed to install it. Maybe you figure it out, I haven't been able to get it working yet.
Thanks Paul

@thinkyhead thinkyhead merged commit c5857f9 into MarlinFirmware:RCBugFix Mar 24, 2016
@thinkyhead thinkyhead deleted the rcbugfix_printrboard_revf branch March 24, 2016 07:41
@paulusjacobus
Copy link
Contributor

@thinkyhead I managed to install Flip 3.4.7 and could load the marlin.ino.hex file from Arduino into the Printrbot. The new RCbugfix release runs now on the Printrbot SImple 1403. So far so good. The only issue that I notice is some z banding on the prints but that is probably and rounding error in the Z step config (2020 steps) and not related to Marlin. So in total Printrbot, Prusa It2 are working for me, Haven't test the corexy yet (just a few dry runs).

@StephS
Copy link
Contributor

StephS commented Mar 28, 2016

The default installed bootloader for the Printrboard and Teensylu is the Atmel DFU bootloader, which requires Atmel FLIP to program. Full programming instructions are here: http://reprap.org/wiki/Printrboard#Loading_Firmware_.28Windows.29
Teensyduino libraries still need to be installed, but their uploader will not work for flashing the firmware.

@StephS
Copy link
Contributor

StephS commented Mar 29, 2016

@thinkyhead I took a look, great job on fixing up my messy code into something that works. Everything looks good, just a few things I want to fix later:

dac_amps(int8_t n) utilizes hard-coded value for the reference current (2.048v). in our case this works because printrbot is the only one using this thing, but in the future we would need the preprocesser to determine the correct value, or move it into the pin definition (confusing since there is already a dac_vref, but that one is a bitmask that is sent, versus the physical ref voltage). this is not critical so long as no-one else designs a board with the same dac and uses an external vref.

I'll try to build and test within the next week.

@thinkyhead
Copy link
Member Author

We will definitely have to add a note that FLIP is needed. Thanks for the info on the voltage. We can certainly make that conditional based on the board type, and I suppose the pins file would be the right place for that. Anyhow, gotta go chase bugs and do another release. Keep us posted!

@paulusjacobus
Copy link
Contributor

@StephS I have updated the Reprap page http://reprap.org/wiki/Printrboard#Loading_Firmware_.28Windows.29 to reflect some of the steps that I encountered for a succesful re-flash of a Printrbot Rev F board.

@StephS
Copy link
Contributor

StephS commented Mar 29, 2016

@thinkyhead I had a look comparing the printrbot branch to the latest RC, it looks like for Extrudrboard support they disable the JTAG pins using #define DISABLE_JTAG true
From the comments it appears that the method is specific to the AT90USB1286
see RC...Printrbot:revf-metal-simple
in Pins.h and marlin_main.cpp (main looks like it sets the registers to disable JTAG).
For now, it looks like it will remain unsupported, but I would love to get @lwalkera to add his feedback if there were other changes.

@lwalkera
Copy link

Yeah, setting that register is all you need, but there are a few gotchas you have to be careful of.

  1. The timing is pretty strict. IIRC, you need to have the writes to the register within 4 clocks of each other to unlock the register. See the datasheet for more info.
  2. You have to do it pretty early in the boot process so the main FW doesn't try to use them

@thinkyhead
Copy link
Member Author

I'm a little drowsy at the moment, so… is there anything I need to do to correct the pins files and JTAG disabling code?

@cbxbiker61
Copy link

FYI,

I'm Building/Installing with Linux on Simple Metal.

If you install teensyduino and dfu-programmer you can

  1. create a GNumakefile
  2. run make
  3. copy the resulting hex file from /tmp/build* to a new location (while the teensy uploader is displayed).
  4. (on the machine attached to the printrbot - with jumper closed)
    a. run sudo /usr/bin/dfu-programmer at90usb1286 erase
    b. run sudo /usr/bin/dfu-programmer at90usb1286 flash newfirmware.hex
******** GNUmakefile begin ********
TEENSYDUINO = /opt/teensyduino/arduino

printrboard:
    $(TEENSYDUINO) --board teensy:avr:teensypp2:speed=16 --verify --verbose Marlin.ino
******** GNUmakefile end ********

@StephS
Copy link
Contributor

StephS commented May 31, 2016

hey @thinkyhead I found out that the dac_init() is missing from setup in marlin_main.cpp without it, the M909 command won't return anything (dac_init sets a flag that the DAC is connected)
need to add:

  #if ENABLED(DAC_STEPPER_CURRENT)
    dac_init();
  #endif

@thinkyhead
Copy link
Member Author

Thanks @StephS – Just patching that now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants