Remora - Rpi Software Stepping Using External Microcontroller via SPI

More
23 Feb 2022 23:45 #235666 by cakeslob
some more shitty posts from cakeslob incoming

re: i2c eeprom

goal is to read the onboard i2c eeprom most 3d printers have to load the config, and write to the eeprom using the rpi i2c connection.

write side, so far I can read/dump the eeprom, and write to individual registers, usinf i2c-tools. Im having a hard time figuring out how to just send the whole config. i could use some help on this part.

read side from the firmware, I was thinking something like this, and using the sd detect pin to load either from i2c or sd. Not sure how the config will parse from i2c. this is a rough draft of what i was gonna do.
#if defined TARGET_LPC176X || TARGET_STM32F1 || TARGET_SPIDER || TARGET_MONSTER8
#include "SDBlockDevice.h"
#elif defined TARGET_SKRV2 || TARGET_OCTOPUS || TARGET_BLACK_F407VE || TARGET_OCTOPUS_PRO_429
#include "SDIOBlockDevice.h"
#endif

#if defined TARGET_HAS I2C EEPROM
#include "I2CEEBlockDevice.h"


#elif defined TARGET_HAS I2C AND SD
    if PC_14 = true
     SDIOBlockDevice blockDevice;
    else 
     I2CEEBlockDevice i2cee(PB_8, PB_9, 0xa0, 32*1024)
    RemoraComms comms(ptrRxData, ptrTxData, SPI1, PA_4);

Please Log in or Create an account to join the conversation.

More
23 Feb 2022 23:58 #235667 by cakeslob
I thought those pictures you have in the docs looked pretty damn slick, so I did my best to keep with that.

SKR2 (407 and 429)
 

OCTOPUS PRO (429 works as expected)

 


OCTOPUS V1.1 (446 works kinda without bootloader)
 

MONSTER8 (works kinda without bootloader. I can get the config to load if I eject the sd after boot and pop it back in)
 
 
Attachments:
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
26 Feb 2022 00:32 #235832 by scotta
Hi cakeslob,

Nice work! I'll put the PowerPoint file that I have been using for the docs pictures up on Github so we have a central spot.

Yes, how to send the config from the Pi to the board. The LinuxCNC component would need to do some negotiation with the board on start-up to get the board ready to receive the config, but how to send it over? Via SPI or the serial connection...? Hmm will need to think on this.

Please Log in or Create an account to join the conversation.

More
26 Feb 2022 03:42 #235835 by JojoS
@scotta
great stuff, I have tried to follow up the whole thread.
to summarize: it works stable on SKR boards with LPC176x and STM32F4. Communication over SPI, what about Ethernet? Is it still experimental and with what boards? There was also a F407Black, I'm using this also and this board is great. Can be used with fast graphics (lvgl.io) or Ethernet (additional LAN8720 PHY board and built in Mbed support).
I would try with a F767 Nucleo with Ethernet on board or the Disco 746.
Something that is not clear to me: what data is exchanged via SPI or Ethernet? Data from the servo thread I guess, but I could not find docs for this until now. Have checked lots of LCNC docs, but cannot see where this is documented.
Looks also like you've found my SDIO implementation, this was a long discussion in Mbed without result.

Please Log in or Create an account to join the conversation.

More
26 Feb 2022 19:25 #235861 by cakeslob

Hi cakeslob,

Nice work! I'll put the PowerPoint file that I have been using for the docs pictures up on Github so we have a central spot.

Ok cool, I use the skr1.4 diagram a lot to minimize wiring errors, so I figured Id make some updated ones. I still have a few more to make but ill make them once I have working firmware on said boards.



Yes, how to send the config from the Pi to the board. The LinuxCNC component would need to do some negotiation with the board on start-up to get the board ready to receive the config, but how to send it over? Via SPI or the serial connection...? Hmm will need to think on this.


I like what mhel was doing with his by writing it to serial, but Im having a hard time understanding the syntax of the pin assignment. I like the idea of reading on startup. Doing it the way you suggest would be more versatile for boards that do not have i2c broken out, like that ethernet board you are using, and the serial option would be good for boards with no i2c or sd cards, like some of the nucleao boards (if you can even find any)

It appears most (3d printer)boards with eeproms have I2c pins broken out, I didnt want to complicate things because I dont know how to write code to address them.

What I was trying to do is write to the eeprom completely separate from linuxcnc/firmware by hooking the I2C eeprom directly to the rpi I2C, this way you could read and write independent of linuxcnc/firmware. My idea was it could default to read config from sd card is card detect was true, or read

So far I can already connect/read/dump/ write some bytes, but I cannot yet write the whole file. I think I need to leverage one of these
pypi.org/project/smbus2/
pypi.org/project/smbus-cffi/
github.com/pimoroni/py-smbus
raspberry-projects.com/pi/programming-in...-the-i2c-interface-2

Please Log in or Create an account to join the conversation.

More
26 Feb 2022 21:18 #235875 by scotta
Hi, 

The SDIO implementation was a great help to get Remora ported to STM32F4, thanks for your great work and strange that it never made it into the Mbed code base.

Stable Remora is running on the LPC1768 and F4 boards, but I've also had it running on F1 and now F2 boards. Some of the bootloaders seem not to play well and cause boot issues, something which would be great to get to the bottom of. In the Develop branch is a lot of this work.

The SPI or Ethernet payload is sent via the Remora LinucCNC component. It's a simple data structure that sends over the axis frequencies etc, the reply payload is the feedback back to the motion controller.

SPI has been running for ages, Ethernet is relatively new and in beta on an NVEM CNC board that has an onboard PHY. It's working great and very close to release. But it's not Mbed based at this point.

Ethernet with an W5500 ethernet to SPI adaptor is also under development. It's working but I need to get back to the SPI DMA implementation to increase the throughput.
 

Please Log in or Create an account to join the conversation.

More
26 Feb 2022 21:30 #235877 by scotta
Hi cakeslob, 

I think that maintaining the JSON config file format would be the more straight forward approach. Less to rework on the firmware side. The JSON parsing and module loading would not need to be modified, just where the JSON file is being fetched from . This could be from the EEPROM for example.

But how to get it over to the board? I'll need to investigate how to send a text file via SPI. For Ethernet I'd need to establish a TCP connection I think.

For the NVEM board I'm working on it would be neat to be able to send over the config to allow for customisation by the user. It's currently hard coded at the moment, which would be ok for 99% of people.

Please Log in or Create an account to join the conversation.

More
26 Feb 2022 22:43 #235886 by cakeslob

Hi cakeslob, 

I think that maintaining the JSON config file format would be the more straight forward approach. Less to rework on the firmware side. The JSON parsing and module loading would not need to be modified, just where the JSON file is being fetched from . This could be from the EEPROM for example.



Yeah thats what I was going for as well, Im just unclear as to how it would be stored in eeprom , like if it needed to be converted to like a binary file or something, and then converted to ascii to edit

But how to get it over to the board? I'll need to investigate how to send a text file via SPI. For Ethernet I'd need to establish a TCP connection I think.

For the NVEM board I'm working on it would be neat to be able to send over the config to allow for customisation by the user. It's currently hard coded at the moment, which would be ok for 99% of people.



since that was way over my head, I opted for direct i2c to i2c from raspberry pi, since it has an i2c interface and all of these 3d printer boards have i2c broken out already, which connect to the eeprom. Its 2 additional wires. For these kind of boards, I figured we could just dump/edit/write config using the linux i2c api or python i2c api (I figured it could just piggy back onto Aarons config program with a write/dump options, but i havent looked into it yet)


for boards like the NVEM, I was thinking it loads a default config into the eeprom when it loads the firmware for the first time, and then edit it the same way 3dprinters seem to do already. I think 3dprinters use mdi commands to do that, so my idea was either remap some gcodes with .....stuff.... or use serial to edit (similar to what mhel was doing). its pretty easy to add a serial terminal tab into axis gui ( forum.linuxcnc.org/18-computer/42276-rem...spi?start=130#214971 ) , so it could be done there if needed.

Please Log in or Create an account to join the conversation.

More
28 Feb 2022 11:43 #236006 by Zuo99
hi, cakeslob, I have an octopus pro 429 and  glad to see that remora can run on it, my question is which firmware.bin file should I use, Is it 429firmware on the official website of bigtreetech, and the example config for this board .txt

Thanks again for your creative work

Please Log in or Create an account to join the conversation.

More
01 Mar 2022 07:02 #236081 by cakeslob
Hey zuo, sorry about that, it looks like I never posted one
I uploaded one just now, with a sample config
github.com/cakeslob/Remora/tree/octopus_...eBin/OCTOPUS_PRO_429

load both those on to the sd card and pop it in, but check out the documents section for all the steps
remora-docs.readthedocs.io/en/latest/firmware/firmware.html

my sample config is kind of bare at the moment, i only set up 3 stepper motors and nothing else. I encourage you to read the config section and learn how to set up the config, but for now just let me know what other things you need in your config file and i can probably whip up a better sample config.




Dear Scott, Re: github
holy shit sorry i hope im not sending you all those pull requests on github when ever i update my fork. github was a lot harder than i thought it would be , im not really sure how to use it very well, you guys make it look easy, i keep fucking up commits and pulls and branches

Please Log in or Create an account to join the conversation.

Time to create page: 0.338 seconds
Powered by Kunena Forum