Skip to content

Making it work for Ardunio based ATMega328p

gihug-git requested to merge gihug-git/Teathimble_Firmware:master into master

Hi! I followed along your blog and built my embroidery machine based on an Arduino Uno with a CNC shield. The machine works now but I had to make some changes to the code.

  1. The Timer0 is not started for uCs excluding ATMega32/16. Additionally the line 73 PD6_DDR = 0xFF sets all pins of port D to outputs which also includes the encoder and needle inputs. I thought it might also be good to change that also for the ATMega32 (line 41) but I cannot test with such a uC so I left it as is. See first commit.
  2. I observed unconsistent movement of the x axis when using the jog buttons of the control app. I could narrow it down to the variable startpoint_steps in motor.c. It seems that a different process/variable is colliding in memory with it leading to unconsistent steps taken. I found that removing startpoint_steps from the BSS section works out fine altough this is not the most elegant solution. I configured it such that for ATMega328/328P/168 the variable is not put into BSS. For all other uCs it is still in BSS. If you are interested in fixing it "the right way" I will be happy to help. See commit 2.

Merge request reports