1 (edited by XYLenTech 2016-02-18 01:50:50)

Topic: Davinci Jr Repetier Port

I figured this deserved a kick start.  I'd like to see the community get together and get a working port of the Repetier firmware for the Davinci Jr (if possible).  I wish I was savvy enough to do this on my own, however I am not.

Here's what I've gathered:
1) There is a working port of Repetier for the Davinci 1.0
2) The Davinci 1.0 uses a custom board driven by an Amtel microcontroller - the ATSAM3X8E
3) The ATSAM3X8E uses an ARM CPU - the Cortex-M3
4) The Arduino DUE is based on the ATSAM3X8E MCU
4) The Davinci Jr. uses a custom board driven by an Amtel microcontroller - the ATSAM4E8E
5) The ATSAM4E8E uses an ARM CPU - the Cortex-M4
6) The Cortex-M4 and Cortex-M3 share the same architecture and instruction set
7) There are some differences in the ATSAM3X8E and ATSAM4E8E MCUs.  Here is a table of differences:
    http://i.imgur.com/Uqw8rVa.png

So, to those of you more knowledgeable than myself, here are my questions:
1) How feasible is porting the Repetier FW to the Jr?
2) How does the Jr using the ATSAM4E8E vs the ATSAM3X8E impact our ability to re-use the work done for the other Davinci models?
3) Assuming this is doable, what's our first step?  A pin trace similar to that performed for the other Davinci models?

I appreciate any help on this.  The folks over in the cartridge reset thread have been doing a fantastic job of whittling down the spool DRM.  If we have that kind of support on the FW front I'm confident we can get a working port in no time.

2

Re: Davinci Jr Repetier Port

I fully support this and would definitely like a working port of repetier to the Jr. Unfortunately I lack the knowledge to work on this  as well. I hope people see this and get on it.

3

Re: Davinci Jr Repetier Port

XYLenTech wrote:

I figured this deserved a kick start.  I'd like to see the community get together and get a working port of the Repetier firmware for the Davinci Jr (if possible).  I wish I was savvy enough to do this on my own, however I am not.

Here's what I've gathered:
1) There is a working port of Repetier for the Davinci 1.0
2) The Davinci 1.0 uses a custom board driven by an Amtel microcontroller - the ATSAM3X8E
3) The ATSAM3X8E uses an ARM CPU - the Cortex-M3
4) The Arduino DUE is based on the ATSAM3X8E MCU
4) The Davinci Jr. uses a custom board driven by an Amtel microcontroller - the ATSAM4E8E
5) The ATSAM4E8E uses an ARM CPU - the Cortex-M4
6) The Cortex-M4 and Cortex-M3 share the same architecture and instruction set
7) There are some differences in the ATSAM3X8E and ATSAM4E8E MCUs.  Here is a table of differences:
    http://i.imgur.com/Uqw8rVa.png

So, to those of you more knowledgeable than myself, here are my questions:
1) How feasible is porting the Repetier FW to the Jr?
2) How does the Jr using the ATSAM4E8E vs the ATSAM3X8E impact our ability to re-use the work done for the other Davinci models?
3) Assuming this is doable, what's our first step?  A pin trace similar to that performed for the other Davinci models?

I appreciate any help on this.  The folks over in the cartridge reset thread have been doing a fantastic job of whittling down the spool DRM.  If we have that kind of support on the FW front I'm confident we can get a working port in no time.

What you really need to do is reverse engineer and actual JR. board by back tracing all the outputs and inputs from their connectors to the each pin of the processor. Then using a pinout of the processor identifying what port is used for each pin and function. Then it is simply a matter of editing pins.h and some other areas of the firmware..

Printing since 2009 and still love it!
Anycubic 4MAX best $225 ever invested.
Voxelabs Proxima SLA. 6 inch 2k Mono LCD.
Anycubic Predator, massive Delta machine. 450 x 370 print envelope.

4

Re: Davinci Jr Repetier Port

carl_m1968 wrote:

What you really need to do is reverse engineer and actual JR. board by back tracing all the outputs and inputs from their connectors to the each pin of the processor. Then using a pinout of the processor identifying what port is used for each pin and function. Then it is simply a matter of editing pins.h and some other areas of the firmware..

I figured before starting to do a pin trace I'd see if I was able to erase the current flash.  I traced the startup pin associated with the ERASE function (pin 87) to a location where I could jump it and was able to execute the erase on startup.  Sweet.  Now that I have a completely useless printer I'm going to attempt two things:

1) Upload and execute custom code to the MCU
2) Revert back to stock firmware

I'm dog paddling in the deep end here but sometimes sacrifices must be made in the pursuit of knowledge!

5

Re: Davinci Jr Repetier Port

do you have picture of the location of the pin 87 ?
I plan to buy a JR soon and will work on it

6

Re: Davinci Jr Repetier Port

luc wrote:

do you have picture of the location of the pin 87 ?
I plan to buy a JR soon and will work on it

Pin 87 can be traced to TP89.  This is where I jumped to erase the flash:
http://i.imgur.com/hocPvl4.png

WARNING TO READERS: This will make your printer unusable!  Don't do this unless you know what you're doing or are willing to brick your printer!

I'm still working on flashing back to the Davinci firmware.  Unlike the other Davinci boards that use the ATSAM3X8E chip, you can't use the Arduino IDE or BOSSAC to write it (since the Jr's chip isn't supported).  I've tried the Atmel SAM-BA software but it only has an option for the ATSAM4E evaluation kit - which I think is causing some issues.  Right now I'm attempting to modify BOSSAC to be able to write to the ATSAM4E family.  I can establish communication via USB, recognize the chip, and read from the chip.  I'm just working out some issues writing pages to flash.

7

Re: Davinci Jr Repetier Port

This is the kind of work I was hoping to see rather than trying to simply hack the RFID on the filament. This way you will also be able to make needed adjustments, control motor current better, and simply have much better control of YOUR machine, not theirs.

Printing since 2009 and still love it!
Anycubic 4MAX best $225 ever invested.
Voxelabs Proxima SLA. 6 inch 2k Mono LCD.
Anycubic Predator, massive Delta machine. 450 x 370 print envelope.

8

Re: Davinci Jr Repetier Port

I had some spare time to poke at this a bit more.  I was able to modify the bossac utility to connect, read, and write to the flash.  I erased the flash, wrote the firmware bin, verified, and set the boot mode to flash.  However, I'm still not getting a bootable printer at this point.  Not sure what the deal is.

9 (edited by luc 2016-03-02 21:31:04)

Re: Davinci Jr Repetier Port

flashing the current FW and not having the printer working it is normal - it is pretty sure the jr does not use same pinout as 1.0
so screen and normal functions won't work unless correct pinout is used.
I guess you use Due core, variant.cpp must be modified to match the pins of mcu also because it is not a due one.

Did you try to compile/flash a simple sketch doing a

Serial.print("hello world");

to check code is properly uploaded, working and communicated with serial monitor ?

10

Re: Davinci Jr Repetier Port

luc wrote:

flashing the current FW and not having the printer working it is normal - it is pretty sure the jr does not use same pinout as 1.0 so screen and normal functions won't work unless correct pinout is used.

I was flashing the compiled Davinci Jr. firmware (.bin) back onto the chip, not trying to flash Repetier.

luc wrote:

I guess you use Due core, variant.cpp must be modified to match the pins of mcu also because it is not a due one.

Did you try to compile/flash a simple sketch doing a

Serial.print("hello world");

to check code is properly uploaded, working and communicated with serial monitor ?

I have not modified variant.cpp nor have I tried compiling/uploading any custom code.  Perhaps I'll give that a go.  Bear with me here, this is uncharted territory for me.

11

Re: Davinci Jr Repetier Port

Comparison of SAM4E8E and SAM3X8E pins:

Name                SAM4E8E Pin        SAM3X8E Pin
====================================================
PD0                 1                  13
PD31                2                  -
VDDOUT              3                  56
PE0                 4                  -
VDDIN               5                  57
PE1                 6                  -
PE2                 7                  -
GND                 8                  12
ADVREFP             9                  -
PE3                 10                 -
PC0                 11                 130
PC27                12                 138
PC26                13                 137
PC31                14                 -
PC30                15                 103
PC29                16                 102
PC12                17                 94
PC15                18                 97
PC13                19                 95
PB1                 20                 114
PB0                 21                 113
PA20/PGMD8          22                 72
PA19/PGMD7          23                 71
PA18/PGMD6          24                 70
PA17/PGMD5          25                 9
PB2                 26                 115
PE4                 27                 -
PE5                 28                 -
VDDCORE             29                 10
VDDIO               30                 11
PB3                 31                 118
PA21/PGMD9          32                 107
VDDCORE             33                 45
PD30                34                 -
PA7/PGMNVALID       35                 26
PA8/PGMM0           36                 27
PA22/PGMD10         37                 81
PC1                 38                 55
PC2                 39                 59
PC3                 40                 60
PC4                 41                 116
PA13/PGMD1          42                 6
VDDIO               43                 62
GND                 44                 58
PA16/PGMD4          45                 78
PA23/PGMD11         46                 80
PD27                47                 -
PC7                 48                 65
PA15/PGMD3          49                 8
VDDCORE             50                 61
PA14/PGMD2          51                 7
PD25                52                 -
PD26                53                 -
PC6                 54                 64
PD24                55                 -
PA24/PGMD12         56                 79
PD23                57                 -
PC5                 58                 63
PA25/PGMD13         59                 108
PD22                60                 -
GND                 61                 106
PA26/PGMD14         62                 109
PD21                63                 -
PA11/PGMM3          64                 4
PD20                65                 -
PA10/PGMM2          66                 3
PD19                67                 -
PA12/PGMD0          68                 5
PD18                69                 -
PA27/PGMD15         70                 110
PD28                71                 -
VDDIO               72                 105
PA5/PGMRDY          73                 25
PD17                74                 -
PA9/PGMM1           75                 2
PC28                76                 139
PA4/PGMNCMD         77                 83
PD16                78                 -
PB6                 79                 121
VDDIO               80                 125
VDDCORE             81                 104
PC8                 82                 66
NRST                83                 69
PD14                84                 -
TEST                85                 -
PC9                 86                 67
PB12                87                 86
PD13                88                 -
PB7                 89                 122
PC10                90                 117
PA3                 91                 84
PD12                92                 -
PA2                 93                 85
PC11                94                 93
GND                 95                 126
VDDIO               96                 -
PC14                97                 96
PD11                98                 -
PA1/PGMEN1          99                 24
PC16                100                98
PD10                101                32
PA0/PGMEN0          102                23
PC17                103                99
JTAGSEL             104                46
PB4                 105                119
PD15                106                -
VDDCORE             107                124
PD29                108                -
PB5                 109                120
PD9                 110                22
PC18                111                100
PA28                112                111
PD8                 113                21
PA6/PGMNOE          114                82
GND                 115                -
PA30                116                -
PC19                117                101
PA31                118                -
PD7                 119                20
PC20                120                131
PD6                 121                19
PC21                122                132
VDDCORE             123                -
PC22                124                133
PD5                 125                18
PD4                 126                17
PC23                127                134
PD3                 128                16
PA29                129                112
PC24                130                135
PD2                 131                15
PD1                 132                14
PC25                133                136
VDDIO               134                -
GND                 135                -
PB10                136                128
PB11                137                129
GND                 138                -
VDDPLL              139                34
PB14                140                140
PB8                 141                123
PB9                 142                127
VDDIO               143                -
PB13                144                87
PB26                -                  1
PB28                -                  28
PB29                -                  29
PB30                -                  30
PB31                -                  31
GNDPLL              -                  33
XOUT                -                  35
XIN                 -                  36
DHSDP               -                  37
DHSDM               -                  38
VBUS                -                  39
VBG                 -                  40
VDDUTMI             -                  41
DFSDP               -                  42
DFSDM               -                  43
GNDUTMI             -                  44
NRSTB               -                  47
XIN32               -                  48
XOUT32              -                  49
SHDN                -                  50
TST                 -                  51
VDDBU               -                  52
FWUP                -                  53
GNDBU               -                  54
PB27                -                  68
VDDANA              -                  73
GNDANA              -                  74
ADVREF              -                  75
PB15                -                  76
PB16                -                  77
PB17                -                  88
PB18                -                  89
PB19                -                  90
PB20                -                  91
PB21                -                  92
PB22                -                  141
PB23                -                  142
PB24                -                  143
PB25                -                  144

12

Re: Davinci Jr Repetier Port

For 1.0A / 2.0A and AiO flashing FW using bossac is not working they encrypted FW so this should happen also for Jr

13

Re: Davinci Jr Repetier Port

if you are able to run this sketch and see the result on serial monitor,

void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);           // set up Serial library at 9600 bps
}

void loop()                       // run over and over again
{
  Serial.println("Hello world!");  // prints hello with ending line break
  delay(1000);
}

the next steps will be :
1 - rewrite the variant.cpp
2 - find the pinout for every element of printer: motors, extruders, sensors, light if any, buzzer etc....
3 - test if need a custom table for thermistor and generate one if necessary
4 - calibrate the printer axis and extruders
5 - test print


The 1 is not difficult but boring
The 2 need to be done carefully as you may damage the printer if use the wrong pin to wrong usage, no mention about wrong manipulation if you do a short during some measurement
The 3 need to be done several times to get average data to get reproductible results accross all printers
The 4 and 5 are piece of cake ^_^

14

Re: Davinci Jr Repetier Port

Near as I can tell, the FW .bin is indeed encrypted. There is likely a decryption algorithm built into the bootstrap code for stock FW updates. That being the case, erasing the entire flash contents would have erased this too. Probably AES encrypted considering the built in AES crypto engine on the chip.

A hex dump of the FW gave "DaVinciJR1.0" as the first few bytes. Definitely not a valid vector table or jump to alternate vector table as would be needed by ARM core. Hex dumps of DV1.0 were not encrypted as there were very readable ascii strings/tables easily found around 2/3 the way through the code. No such luck with Jr FW. 

Just FWIW.

15

Re: Davinci Jr Repetier Port

Any update on this? I would be happy to help out in any way possible!

16

Re: Davinci Jr Repetier Port

Hello,
it's fantastic that somebody has started with porting Repetier.
I'd love to help, but I haven't tools for it, only thinks I can share is what get from XYZware, I know it's not enough but for sure I can tell:
- XYZ using Repetier
- Slic3r
- Skeinforge
In their app.
They are talking with printer by text commands and their trying to parse responses from printer.
I'm trying to talk with printer by myself but for now without success.

17

Re: Davinci Jr Repetier Port

jakecrowley wrote:

Any update on this? I would be happy to help out in any way possible!

Sorry, no update.  All work and no play lately.  Not sure what you can do to help....not sure what I'm doing myself to be honest!

18

Re: Davinci Jr Repetier Port

XYLenTech wrote:
jakecrowley wrote:

Any update on this? I would be happy to help out in any way possible!

Sorry, no update.  All work and no play lately.  Not sure what you can do to help....not sure what I'm doing myself to be honest!

LenTech, I PM'd you a little while back with some things to look for. Let me know if it helps.
Doc

19

Re: Davinci Jr Repetier Port

I killed the PN512 chip which is the NFC Chip, so I have a working but can't be used Junior.  I'm not sure what I'm going to do with it.  I would love the port that would eliminate the need for the chip.  Is there anything I can do with that full functional, but can't be used printer that would help your effort?  I'm not sure what I want to do I keep thinking of trying a RAMPS 1.4 overhaul, but think it would be a lot of work. 

Basically I'm saying I might be willing to do something with the printer that might be harmful knowing that it is of no use to me without this Repetier port or hard hours setting up a new motherboard which I wouldn't care if this motherboard was damaged.

20

Re: Davinci Jr Repetier Port

greatone76 wrote:

I killed the PN512 chip which is the NFC Chip, so I have a working but can't be used Junior.  I'm not sure what I'm going to do with it.  I would love the port that would eliminate the need for the chip.  Is there anything I can do with that full functional, but can't be used printer that would help your effort?  I'm not sure what I want to do I keep thinking of trying a RAMPS 1.4 overhaul, but think it would be a lot of work. 

Basically I'm saying I might be willing to do something with the printer that might be harmful knowing that it is of no use to me without this Repetier port or hard hours setting up a new motherboard which I wouldn't care if this motherboard was damaged.

We need a pinout from the chip to all pertinent parts - stepper drivers, end stops, fans, heater, light, etc. Also pertinent signal levels for each.

21

Re: Davinci Jr Repetier Port

Hi anyone has a davinci Jr FW and can share it ? my Jr is brand new and no copy of FW but I would like to have a look to it

Thanks,

22

Re: Davinci Jr Repetier Port

luc wrote:

Hi anyone has a davinci Jr FW and can share it ? my Jr is brand new and no copy of FW but I would like to have a look to it

Thanks,

The firmware is encrypted, all the decryption is done on the printer itself.

23 (edited by luc 2016-04-21 21:05:26)

Re: Davinci Jr Repetier Port

Yes I know that, I wrote it above wink

24

Re: Davinci Jr Repetier Port

luc wrote:

Yes I know that, I wrote it above wink

Well, if you still want the firmware, I have a copy of the FW v2.2.0
https://drive.google.com/open?id=0B76NY … VNvc1ZvRWM

25

Re: Davinci Jr Repetier Port

thanks a lot - this is to work on first part of porting SAM4E8E and Jr board to arduino IDE