Remora - Rpi Software Stepping Using External Microcontroller via SPI

More
4 years 8 months ago #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.
Code:
#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
4 years 8 months ago #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)
 
 
The following user(s) said Thank You: tommylight

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

More
4 years 8 months ago #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
4 years 8 months ago #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
4 years 8 months ago #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
4 years 8 months ago #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.

Time to create page: 0.583 seconds
Powered by Kunena Forum