SPI speed issue...

Hi everyone,
Any assistance with this issue would be greatly appreciated (will pay if needed). I have configured a serial port to be a 1.8Mb SPI. The data truely does transfer at the correct speed, but the driver does not return for approximately 700us after the transfer is complete. That is a dramatic difference from the ~25us it should be. Interestingly, when the BSP function is called to write the data out, it very quickly writes out all of the data, then there appears just be a delay for the 700us, nothing is going on. Is there any DTR/DTS/RTS type things that could hold this off from returning immediately after the data is transferred? Any suggestions on what the delay is?

Thanks,
Bradley

What driver are you using? Your custom driver or the one provided in BSP?

Adrian

The one in the BSP … btw, thanks for responding so quickly Adrian!

Thanks,
Bradley

The serial drivers provided are running based on serl_monitor thread (see mercury_serl.c file from BSP).

The write function is netos_serlwrite (which is called by netos_spiwrite from netos_spi.c). This function waits for a flag from serl_monitor to be set if you choose the write to be a blocking function. You can opt for a non-blocking write, but in this case it will return without waiting for the message to be actually sent out.

If you strictly need to return after the whole message was sent out, you have to write your own driver or modify the existing one. I would suggest to use some GPIOs and geenerate small pulses when you completed the DMA transfer to SPI (in tx_dma_int function) and when you exit from write. If the first one comes right after your transfer, that means there are ways to fix it but you need to change the drivers.

Basically, the end of trasfer generates the interrupt, but above this there is this serl_monitor which checks if the transfer was completed and allows the write function to return. They are actually replacing interrupts with polling. This generates extra delay.

Hi Adrian,

Thank you very much for your help, I am going to first determine if the time reduces by using the non-blocking write first.  If that does change the time for the write() function to return, then I believe we can come up with a good solution.  I'd prefer to not change the BSP drivers so that they everything stays portable, but I suppose that is the majic of having the source for the BSP :).  Is there anyway I can compensate you for your time on my issue?  If so, send me an email to ibprogramming@hotmail(.)com (without the parens).

Thanks,
Bradley

I sent you one email on your private e-mail stating that there is no compensation required. I want to be sure you will not receive any other scam e-mails so I reiterate it here. Not a very good idea to make your e-mail public…