Coder Social home page Coder Social logo

Comments (10)

xobs avatar xobs commented on May 23, 2024 3

FYI: I've been porting this to ESP32, and I've moved to using the SPI driver. My implementation is up at xobs@f386d25 and currently suffers from a number of problems:

  1. It doesn't tristate the bus afterwards, meaning both the SWD device and BMP drive the bus.
  2. There are very long pauses between SPI transactions, and I currently do two transactions when transmitting or receiving parity bits. This adds a lot of overhead.
  3. The speed is hardcoded to 5 MHz currently.

These are not insurmountable problems, and I intend to rewrite the SPI interface so that it uses lower-level constructs rather than the Espressif drivers, which do a lot of locking, unlocking, and allocating.

I believe when it says that it will receive additional "random" bits, what it means is that it inhibits the SPI_CLK line output but the SPI block still clocks in those bits. As a result, the additional bits are effectively don't care. That is, if you ask it to read 3 bits of data, then you'll get 3 bits of good data and 5 bits of garbage. Which is fine, you were going to ignore the garbage data anyway, just mask it off. Plus it's probably 0 anyway.

So far I've managed to communicate with a SAMD09 board via an ESP32 using this setup. I've dumped memory, done a mass_erase, and restored flash. So in my very limited testing this approach seems viable, and much more reliable than the bit-bang approach.

from blackmagic-espidf.

xobs avatar xobs commented on May 23, 2024 3

I hadn't seen that -- it's very handy, and I might take their SPI code.

from blackmagic-espidf.

MrZANE42 avatar MrZANE42 commented on May 23, 2024

https://community.st.com/s/question/0D50X0000BmnMM5/stm32-use-spi-implement-swd

from blackmagic-espidf.

UweBonnes avatar UweBonnes commented on May 23, 2024

Can the ESP32 do SPI from 1 to at least 8 bits. Then doing SWD should be doable. Otherwise fast bitbanging can also get you a long way.

from blackmagic-espidf.

MrZANE42 avatar MrZANE42 commented on May 23, 2024

According to the page below it seems like it should be possible to send/receive 'frames' that are shorter than 8 bits.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/spi_master.html

from blackmagic-espidf.

UweBonnes avatar UweBonnes commented on May 23, 2024

The page tells: "The Device will still receive 8 bits with 3 additional “random” bits, so the reading must be performed correctly." Random bits in a strict protocol are not good ;-(

from blackmagic-espidf.

MrZANE42 avatar MrZANE42 commented on May 23, 2024

My take away from that is that it will just shift in the number of bits requested and the data in register for the other bits are to be considered random.

from blackmagic-espidf.

UweBonnes avatar UweBonnes commented on May 23, 2024

I do not understand why a bitbang approach should be less reliable.

from blackmagic-espidf.

xobs avatar xobs commented on May 23, 2024

I'm not sure. It felt like a pulse synchronizer issue that I was running into on ESP32 where GPIO inputs and outputs weren't synchronized despite the presence of memw, wherein reads to a GPIO bank were returned before the bit actually reached the pin. The memw instruction just ensures that the memory access has reached the IO_MUX block, but it doesn't ensure that bit has made its way out to the real world.

There's also the issue of disabling interrupts, which seems like it can adversely impact wifi on the single-core ESP8266. Using SPI would mean avoiding the need to disable interrupts, which should give you more reliable networking.

from blackmagic-espidf.

peddamat avatar peddamat commented on May 23, 2024

@xobs Appreciate both of your efforts, just wanted to make sure you’d seen this: https://github.com/flipperdevices/blackmagic-esp32-s2

from blackmagic-espidf.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.