2024-11-08 12:41 PM - last edited on 2024-11-09 01:40 AM by Andrew Neil
I am developing some trackers for personal use in VR and have found an excellent solution that meets my needs using the STM32CubeIDE environment and some boards. I create and test the files, but I realize that debugging over serial communication is not my preferred method. Instead, I want to transmit the data using an nRF module to a PC program that will utilize this information, to achieve this I'm using this part as a drop-in circuit and then linking it to the RF side of things. The STM32 will contain the flash and output the fused data raw to the NRF which includes all the connection and base firmware code, How can I modify the serial communication(or change it in the cube ide environment) to use protocols like I2C or SPI so that I can integrate it into a circuit? after I figure this out I can move to making the boards.
2024-11-08 05:12 PM - edited 2024-11-09 02:02 AM
You can send your own debug prints in any format you like, over any interface including the ITM.
However if you want to substitute the debugger interface from SWD to something else, this is not feasible because the SWD has special path to the guts of STM32.
2024-11-08 08:49 PM
how would I do this? I'm a student and pretty new to this.
2024-11-09 12:58 AM
for example, if I used this bin, flashed it on a stm32 production board and chipset, and wanted it to communicate via i2c, is there a setting I need to enable on the dev side when I compile it or is it set to do that automatically?
2024-11-09 01:52 AM
Your title says Serial Wire Debug, but then you say:
@Syntech wrote:debugging over serial communication .
which sounds like you're just using a UART - is that right?
via printf, or similar?
CubeIDE has examples of both SPI and I2C - I suggest you start with them, and use them to gain understanding of how to use those interfaces...
https://wiki.st.com/stm32mcu/wiki/Getting_started_with_I2C
https://wiki.st.com/stm32mcu/wiki/Getting_started_with_SPI
To use them effectively, you will need at least a basic understanding of how they work in general.
Both SPI and I2C are very well-established and widely-used - so there are plenty of general tutorials on them; eg,
SPI:
https://en.wikipedia.org/wiki/Serial_Peripheral_Interface
https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi/all
https://www.avrfreaks.net/s/topic/a5C3l000000UacsEAC/t154582?comment=P-1246580
I2C:
https://www.nxp.com/docs/en/user-guide/UM10204.pdf
https://en.wikipedia.org/wiki/I%C2%B2C
https://learn.sparkfun.com/tutorials/i2c/all
https://www.i2c-bus.org/http://www.i2c-bus.org/i2c-bus/
2024-11-09 02:00 AM - edited 2024-11-09 02:02 AM
The debug interface that the CubeIDE debugger uses is SWD only (or JTAG) - you can't change that.
But, as @Pavel A. said, you can use any interface you like to send your own output messages to any "receiver" of your choice. Probably the commonest (and easiest?) choice is to use a UART to send to a terminal.
The advantage of using UART and terminal is that terminal apps - especially free ones - are ubiquitous, but apps to receive SPI, I2C, etc are much rarer, so will likely require you to do a lot more work on the Host end.
Another advantage is that there are plenty of RF modules that will simple take a UART data stream and transport it transparently over the air.
@Syntech wrote:I'm a student and pretty new to this
So discuss this with your tutors - they will be able to give advice appropriate to your situation and the assignment you've been given.
2024-11-09 02:06 AM
Wireless SWD... perhaps this? https://github.com/walmis/blackmagic-espidf
2024-11-09 03:59 AM
@Syntech wrote:I want to transmit the data using an nRF module to a PC program that will utilize this information.
reading this again, that sounds more like operational data than debug ?