Multiple, simultaneous, SPI buses handling and Smart SD mounting#7
Multiple, simultaneous, SPI buses handling and Smart SD mounting#7LinoBarreca wants to merge 102 commits intobugfix-2.0.xfrom
Conversation
Every bus has multiple devices which have to be defined with pin/type Each SPI call is now directed to a device SD Cards can now be more than one and can be attached to any SPI bus
and access STM SPI driver directly bypassing framework
|
Reporting: |
|
nothing else? |
|
Nothing else, flooded octoprint serial monitor with this lines, repeating. The only different lines where those mentioning frequency. |
|
take out the SD card from the screen. |
|
SD Card from screen: out |
|
was it out before? |
|
No, it was in |
|
okay. since you are using octoprint you can disconnect and reconnect (through octoprint) |
|
Ok, will do |
|
Recv: SPI 1 State: 1, Error: 0 |
|
(buffer full) |
|
Is the display working? |
|
Both displays are working, visually at least. Shall I issue some commands? I' noticed some changes in the pins file, drivers section |
|
Axis seem to work fine, issuing commands from TFT35 display. I'll try the Ender display now |
|
This message from SPI 1 is just repeating continuously, but I'm almost sure I've seen SPI 2 related lines and an "SD card found" |
|
I'm recording a serial log from octoprint, maybe that can give further light |
|
Okay. I am not at the computer. The buffer is flooded because most likely you have a spi display and the calls are dumped. I need to filter those out but it's gonna be tomorrow. Meanwhile can you search for "spi 0" in the buffer (at the very start) or do a connect and disconnect after a couple of seconds so you preserve lines at the start. |
|
Ok, understood, I'll try. But I've never seen any related SPI 0 messages, just 1 and 2. I'll check also the log for info. |
|
They should be at the very first start. When marlin boots. |
|
Ok, I've got logs with more info. |
|
I understood :D |
provide a method to write to the bus regardless what device you are talking to
|
Hi @LinoBarreca . I'm definitively unable to find out how to use STlink to upload the firmware. |
|
@Patag good morning. Yes I can, as I said you need to specify the upload address to do the upload. I don't remember it because I don't have the board but it should be around 0x8000 if I remember correctly. to check (before doing damages) just take a firmware.cur from the card and search the first binary bytes (let's say 10 bytes) in the memory chip. the starting point is the upload address. then go to platformio guide to see how to specify it. |
|
@Evg33 @Patag https://community.platformio.org/t/jlink-uploading-to-incorrect-address/6085/3 I think that option only applies to jlink. use a custom command. Opening a bug to platformio. It seems that they knew they were uploading it in the wrong place but they modified only jtag and not stlink...also.. I strongly believe the user shouldn't care about forcing the address...the default configuration should work out of the box without "destroying" the hardware. |
|
@Evg33 & @Patag analyzing the code EDIT: analized openocd. The address (so the above option) is used only when you flash a bin. when you flash the ELF it should analyze the elf and program it as expected. |
|
Hi @LinoBarreca and @Evg33 |
|
Ok |
|
Hi @LinoBarreca Not tested with actual stepper, but it makes the trick at least for booting. According to my debugger session, it was previously catch by a unexpected interruption handler coming from TMC5160 init and pointing to an infinite loop. Next step, I'm still not able to use my TFT35V3 to get my LCD SD working. |
Nice catch bro! |
|
@Patag... wait... there's something which doesn't make sense. |
|
Marlin automatically uses E1 for Z2 when you set a dualZ stepper config. |
|
then it should use the already defined E1...no? gotta troubleshoot it better |
|
Don't think so, because it has to swap from DRIVER_EXTRUDER to DRIVER_AXIS in this case. |
|
And for the PR, I let you make it for more consistency. I'm too old for this kind of glory ;-) |
|
you are right. Actual logic needs one more logic layer of separation. |
|
but now I've run into another problem. |
|
And I was wrong. It's not E1 but E2 used for Z2 in my conf Dual Z / 2 extruders (tested with a stepper with official Marlin branch). So my change becomes and tested with your branch, it works. We definitely have to find out the Marlin logic when affecting an axis to a stepper.... |
|
@Patag at the moment I'm trying to un-fuck-up what Scott did to my code. I created a "branch" MultiSPImio which is MultiSPI BEFORE his changes. |
|
OK, let me know if you need some more tests |
|
I am pausing all the development on this until saturday 28. |
|
Merry Christmas and happy new year eve also ! |
Hi @LinoBarreca I think I've found out the Marlin multi stepper logic. I just reverse engineered the pin.h file where it's described. Not a priority but it will help for the next steps. |
Hi @Patag . It can't be done this way 'cause E##p##_##q##_PIN will be undefined since it's defined in the array. |
|
Humm not sure to understand. E##p##_##q##_PIN is defined outside of the SPI_Devices array ?! (or it's my decreasing view). It is used to determine X2_CS_PIN, Y2_CS_PIN...Z3_CS_PIN that are used later in the array. It has been successfully tested on X/X2/Y/Z/E0/E1, X/X2/Y/Y2/Z/E0, X/Y/Z/Z2/E0/E1 and X/Y/Z/Z2/Z3/E0 configurations with real steppers. BTW, I'm not able to compile your latest commit : |
|
@Patag let me explain better. point of this is to avoid use of "hardcoded" X2* X3*, E2*, E1* and so on.
I fixed it. |
|
OK, I definitely don't have the "big picture" of what you want to achieve... |
|
@Patag it isn't about the big picture. I just want this to be closed as soon as possible but it's logical that this new layout can (and sooner or later will) led to multiple axis, multiple cards, multiple devices. Actually it's only X, Y, Z and some "non-planar" 3d printing is achieved by changing Z |
Not really. addr 134250496 = 0x8008000 (in the .isr vector)
the correct upload command should be but it won't still work because at the "upload stage" you still don't have the .bin but just the .elf |
|
Nope, can't be agreed with this.
Same here. I've to build then upload to make it working |
We will use this place to have a feedback from testers.
I am reopening this because last one was closed by github as I rebased the changes.
SKR-PRO ONLY (other boards are broken at the moment, don't waste your time trying to build it)
How to test:
Take a clean folder.
Pull the sources.
Add your config files.
Compile.
Put the firmware in the onboard sd.
Turn on the printer.
Let it flash the firmware.
Wait 20 seconds, then plug into an USB port and on the computer open serial monitor.
What will you gain with this PR:
SD? great. How does it work?
#define SD_SEARCH_ORDER { 1, 0 }in configuration.hWhat will it happen when I flash it?
It depends on your current situation.
Things which are known to be NOT WORKING (will be addressed later). In order of priority:
#define SPI_SPEED SPI_HALF_SPEEDin Configuration.h#define TMC_USE_SW_SPI