Remora - Rpi Software Stepping Using External Microcontroller via SPI

More
26 Dec 2021 22:38 #230032 by scotta
Hi, the behaviour you describe is what I get when there is no SD card inserted..

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

More
26 Dec 2021 23:33 #230034 by cakeslob
but i loaded the firmware with the sd card.....
I get the same thing with no sd card also, except the led for sd-det is off. I tried reformatting it with fat and then fat32 and still nothing, how should I be formatting this, and it works with the other boards

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

More
27 Dec 2021 03:27 #230040 by cakeslob
I think the sdblock spi cs pin needs to be a software spi pin , it doesnt look like PC_9 is a hardware spi3 pin

else if (this->interruptPin == PC_9)
    {
        // interrupt pin is not the NSS pin, ie the board shares the SPI bus with the SD card
        // configure the SPI in software NSS mode and always on
        sharedSPI = true;
        HAL_NVIC_SetPriority(EXTI9_5_IRQn , 5, 0);
 
but i dont understand how that last part works

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

More
27 Dec 2021 21:44 #230090 by scotta
Hi, the firmware is loaded by the bootloader code.

We should be able to do everything in hardware as there is no sharing of pins from what I can see in the schematic.

The same pins are used for the SKR2 SD card but in SDIO mode. I'll experiment on that board with the SDBlockDevice to try and understand what is not being configured correctly.

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

More
27 Dec 2021 21:49 #230091 by cakeslob
ok, not working yet, but closer. your patience and help is appreciated as always.
Like you said, SD card, so I read through sdblock, and theres some difference between sdsc and sdhc, so I loaded it and it can mount the file system with the sdhc. so something about my other sd card, it can load the firmware properly but no mount the file system.

So, what I have going now,
it reads the config file, finishes setup, then start, then goes into idle.
when I hit estop , in linuxcnc terminal i get bad spi payload=0 (or 32303a30 depending on what I set my spi1_clk_divsor to) and it goes back into estop.
in remora uart it reloads the setup and goes back into idle, here is the log when i hit estop here is my pinout also
 

File Attachment:

File Name: log.txt
File Size:3 KB

 

I shifted the pru reset over to the next pin , which is btn_en2 aka PE_8, because the pin I would use, SPI1_DET aka PB_11 looks tied to vcap1 and since idk whats going on there, I just changed it to btn_en2.
Attachments:

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

More
27 Dec 2021 22:08 - 27 Dec 2021 22:10 #230094 by scotta
I can't confirm until I can get into the workshop but it would appear we're missing the PC9 chip select option in the PeripheralPins.c definition in the MONSTER8 target. 
MBED_WEAK const PinMap PinMap_SPI_SSEL[] = {
    {PA_4,       SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI1)}, // Connected to I2S3_WS [CS43L22_LRCK]
    {PA_4_ALT0,  SPI_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF6_SPI3)}, // Connected to I2S3_WS [CS43L22_LRCK]
    {PA_15,      SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI1)},
    {PA_15_ALT0, SPI_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF6_SPI3)},
    {PB_9,       SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI2)}, // Connected to Audio_SDA [CS43L22_SDA]
    {PB_12,      SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI2)},
    {NC, NC, 0}
};

I'll need to fire up CubeMX to get the proper definition and give it a go.

Thanks for your persistence with this. The joy of being the first to try a new board out.
Last edit: 27 Dec 2021 22:10 by scotta.

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

More
27 Dec 2021 22:21 - 27 Dec 2021 22:26 #230096 by cakeslob
yeah, thats what I was trying to say with the software pin thing, I dont see it listed in the datasheet as an actual spi pin,  its an SDIO pin, but not SPI cs,  SPI3 cs is either on pin PA_15, or on PA_4 (same as spi1cs), as an alternate pin function 

I did compile a version with this change after I read about the interrupt vector table, but I didnt make a difference so I there theres more I would have had to do, or it only works on SPI1


else if (this->interruptPin == PC_9)
{
// interrupt pin is not the NSS pin, ie the board shares the SPI bus with the SD card
// configure the SPI in software NSS mode and always on
sharedSPI = true;
HAL_NVIC_SetPriority(EXTI9_5_IRQn , 5, 0);


yes, the joy of new boards I am 0/4 so far lol , I honestly though it would be easier once the framework was in place and it makes me appreciate all the hard work that went into it even more.
Last edit: 27 Dec 2021 22:26 by cakeslob.

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

More
27 Dec 2021 22:25 #230097 by scotta

ok, not working yet, but closer. your patience and help is appreciated as always.
Like you said, SD card, so I read through sdblock, and theres some difference between sdsc and sdhc, so I loaded it and it can mount the file system with the sdhc. so something about my other sd card, it can load the firmware properly but no mount the file system.

So, what I have going now,
it reads the config file, finishes setup, then start, then goes into idle.
when I hit estop , in linuxcnc terminal i get bad spi payload=0 (or 32303a30 depending on what I set my spi1_clk_divsor to) and it goes back into estop.
in remora uart it reloads the setup and goes back into idle, here is the log when i hit estop here is my pinout also
 

File Attachment:

File Name: log.txt
File Size:3 KB

 

I shifted the pru reset over to the next pin , which is btn_en2 aka PE_8, because the pin I would use, SPI1_DET aka PB_11 looks tied to vcap1 and since idk whats going on there, I just changed it to btn_en2.

Great news that you have got this far. The SPI comms with the RPi should be straight forward now as it is using the same SPI as the SKR2 board (the board used for STM32 porting). For starters, do not connect the reset pin so as not to trigger an unwanted board reset. If the board resets after too many bad SPI packets then I would look at wiring issues. Try to use as short as practical ribbon cable for the connection between the RPi and the controller board.

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

More
27 Dec 2021 22:30 #230098 by scotta

yeah, thats what I was trying to say with the software pin thing, I dont see it listed in the datasheet as an actual spi pin,  its an SDIO pin, but not SPI cs,  SPI3 cs is either on pin PA_15, or on PA_4 (same as spi1cs), as an alternate pin function 

I did compile a version with this change after I read about the interrupt vector table, but I didnt make a difference so I there theres more I would have had to do, or it only works on SPI1


else if (this->interruptPin == PC_9)
{
// interrupt pin is not the NSS pin, ie the board shares the SPI bus with the SD card
// configure the SPI in software NSS mode and always on
sharedSPI = true;
HAL_NVIC_SetPriority(EXTI9_5_IRQn , 5, 0);


yes, the joy of new boards I am 0/4 so far lol , I honestly though it would be easier once the framework was in place and it makes me appreciate all the hard work that went into it even more.

Hmm, so how is the CS being handled then. I'll need to look into the API to see if it's rolling back to having the CS always low and software NSS configured.

The code snippet is from the RemoraComms and will have no effect on the SD SPI card config.

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

More
27 Dec 2021 23:47 #230101 by cakeslob
so, preface, Im using the same 4"/100mm cable i use for all my remora setups, but ill change over to a 2"/50mm one and see what happens. with no reset pin, it never goes idle and resets every 2 estop clicks.

for the software/hardware cs pin, i figured it would be the same as the mks robin config because looking at all the pin stuff, They both use the same spi1 for main comms , and both use SDblock with software nss, the only difference i see is robin is on spi2 and monster8 is spi3

The way you have it setup looks proper, in sdblock its using dynamic pin mode

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

Time to create page: 0.292 seconds
Powered by Kunena Forum