Is shared SPI working?

Posted on
  • I see a lot of @jeffmer 's code which allows sharing of SPI clock and data has made it into lcd_spi_unbuf. However, when I try to compile using SPIFLASH_SHARED_SPI, I get this error:

    libs/graphics/lcd_spi_unbuf.c: In function 'set_cs':
    libs/graphics/lcd_spi_unbuf.c:63:5: error: implicit declaration of function 'jshSPIEnable' [-Werror=implicit-function-declaration]

    and when reading this message from jeffmer it looks like that function is not in targets/nrf5x/jshardware.c in the main branch. I'll try to add it from his repo, but curious if it is actually somewhere else? Has anyone used this feature in the main branch?

  • Most probably you have some mix of your patched code, this part is not upstream at all, the only occurrence is here­b/25648d5fc9c586e7a3271e944e5e3b3fb9bfd7­4b/targets/nrf5x/jshardware.c#L2458 and it allows to recover when some other code pulls CS high but that 'other code' is not there at all. This part is also not lcd_spi_unbuf specific, it is a minimal fix that allows sharing same spi with flash and anything else (like accelerometer on DK08)

    here­7d8199c993d6c54901c1c819 is patch with @jeffmer 's changes of lcd_spi_unbuf that worked for me, all that is not in upstream Espruino

  • Thank you sir. I thought I'd pulled from the latest, but clearly I did not. Thanks for the patch!

  • Hi, Gordon rightly thought that switching between HW and SW SPI was a bit of a hack and that a more elegant solution would be to see if SPIFLASH code could use HW SPI when sharing SPI was necessary . I did not get round to looking at that and as @fanoush mentions, the HW/SW hack is not in the main Espruino repository.

  • Makes sense, and it does seem like I patched my branch and somehow forgot about it (getting more common these days)... Nice to hear from you @jeffmer! hope all's well...

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Is shared SPI working?

Posted by Avatar for yngv126399 @yngv126399