Contact me: hankecnc@gmail.com

允许其他板具有其他引脚分配 #1193

推推 grbl 3年前 (2023-01-23) 118次浏览

关闭
yellobello 打开了这个问题 2017 年 3 月 4 日 · 8条评论
 Closed

Allow other boards with other pin assignments#1193

yellobello opened this issue on Mar 4, 2017 · 8 comments

注释

允许其他板具有其他引脚分配 #1193

你好,

来自 marlin 的印刷世界,我对 grbl 很陌生。
我买了一块瓷板,我做的第一件事就是将它升级到最新的 grbl 版本,
结果发现这些人使用的引脚映射与 grbl 为官方盾牌所做的不同。
既然我现在已经让它与 grbl 一起工作,我想为什么不问问你们是否可以允许 grbl master 作为不同板的一个选项,就像 marlin 对许多板所做的那样。
但问题可能是我猜该板不是开源硬件。
顺便说一句,我说的是“Laseraxe”板。

允许其他板具有其他引脚分配 #1193
jahnj0584 评论了 2017 年 3 月 4 日 通过电子邮件
允许其他板具有其他引脚分配 #1193
作者

是的,这就是我所做的,但我认为对于像我这样遇到相同问题的人来说,为不同的板保留多个 cpumap 文件,然后在编译前在定义中选择所需的文件会更容易。..只是一个想法

允许其他板具有其他引脚分配 #1193

您已经可以编辑/添加引脚映射到 cpu_map.h,然后更改 config.h 中的以下行以使用所需的引脚映射。:
#define CPU_MAP_ATMEGA328P

允许其他板具有其他引脚分配 #1193
作者
耶洛贝洛 评论了 2017 年 3 月 9 日  

Cool, thats an even better way than what I did.. plus I just thought it would be good to implement some boards into the main grbl codebase to have a couple officially supported boards.

Other thing, kinda related:

Are the pin numbers somehow bit-shifted around? I don´t get the way how some of the pins are assigned.. for example the pwm’d spindle pin, which should be on arduino 11, right?
let´s see:

from cpu_map.h:

// Define spindle enable and spindle direction output pins.
  #define SPINDLE_ENABLE_DDR    DDRB
  #define SPINDLE_ENABLE_PORT   PORTB
  // Z Limit pin and spindle PWM/enable pin swapped to access hardware PWM on Pin 11.
  #ifdef VARIABLE_SPINDLE
    #ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
      // If enabled, spindle direction pin now used as spindle enable, while PWM remains on D11.
      #define SPINDLE_ENABLE_BIT    5  // Uno Digital Pin 13 (NOTE: D13 can't be pulled-high input due to LED.)
    #else
      #define SPINDLE_ENABLE_BIT    3  // Uno Digital Pin 11
    #endif

pins 3 and 5 have been assigned to Y_STEP_BIT and Z_STEP_BIT some lines above this code.
ok, so I have a look whats going on with SPINDLE_ENABLE_BIT, SPINDLE_ENABLE_DDR and DDRB in spindle_control.c but then I completely loose track because it´s all bit-shifting around..

I don´t get it.. sorry

允许其他板具有其他引脚分配 #1193

@yellobello same bit number different port

允许其他板具有其他引脚分配 #1193

I see a big problem if you want to use a shield with the step and dir pin located on different Ports (like ramps, for example). If I don’t go wrong Grbl wants all the pin of the same type on the same port.
I used the Marlin way (fastio.h) to solve this problem, but this require deeper changes in the source code and probably little longer time to execute the stepper interrupt.
As I also added the 4th and 5th axes, I limited the max frequency to about 20kHz, for my foam cutting project this is enough.
I’ll then try to move to Arduino Due, to try higher frequency for larger foam cutting machines.

允许其他板具有其他引脚分配 #1193

@yellobello the grbl pinout has been optimised to get the highest practical performance, and as @duronebis says changing that is not trivial. And for someone like @chamnit it is a support nightmare as there is no way he could test and retest all the user-submitted pin mappings. But being open source, you are completely free to make these changes yourself, and even publish them for others.

Also note that there is no obvious mapping between Arduino pin numbering and port names/bits (or IC pins for that matter). Check out one of the great pin-out diagrams like http://www.pighixxx.com/test/portfolio-items/uno/ which shows all the gory detail.

允许其他板具有其他引脚分配 #1193
Member

仅供参考,基于 Grbl 的项目包括具有硬件抽象的多个引脚分配。但这不包括 328p Uno。只有 Mega、ARM 或任何具有足够内存和闪存的微处理器。我不会支持端口,但有兴趣为社区维护特定端口的用户。

喜欢 (0)