How to store config data to stm32f103C8t6 flash? - stm32

I would like to store my configuration data to flash so it stays permanent after reboot.I am using CooCox CoIDE for development but unable to find any example on how to do it?

Use STM32 EEPROM emulation driver to use few pages of your flash as an EEPROM. More details can be found in any of their application notes/datasheets. You may find the driver here.

Related

How to use a 256x64 OLED Display with STM32 via SPI

I'm working on a proyect with a display with a resolution of 256x64 SPI interface, but i can't find any information about it.
Has anyone worked on this type of display?
This is the display that I'm working on https://www.mouser.cl/ProductDetail/Newhaven-Display/NHD-2.8-25664UCB2?qs=EQmeiuRlVUTjbx5MVlv5%2Fw%3D%3D
I've found the µGUI library, but I'm really new in this kind of proyect, so i don't understand the documentation about it.

How to receive CAN data in a linux device driver?

I want to read the CAN bus and get the data from a specific device on the CAN bus. I have implemented this previously using the Socket communication api that is available in the user space (sys/socket).
I now have a similar requirement but this time working on device drivers which work in the kernel space. The same socket communication is i suppose not available in the kernel space which is why i guess i am not able to compile the kernel module with #include .
An approach i have come up to is to create a device driver for device creation and a supporting user-space program to interact it and provide CAN data by using socket communication. If there is any better approach please suggest me.

How to flash without STLINK

My STLINKV2 is not working anymore, not detected by Linux, it failed after the first successful flash. I ordered a new one but it will take 60+ days to arrive. Meanwhile I have heard on Youtube you can program Bluepills directly by connecting cut open USB cable to certain pins and then using a jumper. But I cannot get any precie information on this, is this really possible and how?
You should use the embedded bootloader. You can flash it through several interfaces. Look at AN2606, maybe you can find an already written flasher. Good luck STM32CubeProgrammer handle it.
If you intend to program it through usb, look also at AN3156 all protocols document are referred in chapter 2 of AN2606
THOSE AREN'T CUT OPEN USB CABLES they are USB to serial adapters for arduino's bootloader
They connect them like this:
The problem is that this requires the Arduino STM32 bootloader to be flashed in it.
Another option will be to use STM32CubeProg this program allows you to program your stm over
Serial
SPI
I2C
USB
You'll need to set the BOOT0 and BOOT1 pins to the correct value (HIGH slash LOW) to allow it to go in flash mode during boot.
Here is semi outdated tutorial which tells most of the steps to program a STM using serial. (the Flash Loader Demonstrator is outdated and you should use STM32CubeProg)

Backup or read settings of a nucleo board stm32

I was wondering if it is possible to back up or read the settings of a nucleo board stm32. It is set up as a P-NUCLEO-LRWAN1 Nucleo pack. Which uses LoRaWAN to send data to a gateway and it works perfectly. I was now wondering if I could change the configuration (like lora settings, data format, etc).
I already tried using stm32 st-link utility, and Keil IDE. But they only flash or erase the board. I don't know how to read it.
I don't have any background on this so, details would be great. Apologies if I used the wrong words to describe things. Thanks!
You can read memory by "st-link utility" software (if you have st-link, of course)
Under "icon menu" you have two text fields: Address and size. Just set correct address and window below will display necessary memory region.
To save data just Select menu File->Save file...
You need to save it into the FLASH memory. FLASH memory can be erased and programed runtime. Read your micro Reference Manual where the procedure of erasing and writing the FLASH page is described in details.

Do platform device drivers have to be registered with a major and minor number.?

I am new to device driver writing and I need to write a SPI driver to access flash memory for a embedded linux running on ARM.
What I don't understand is, do I need to register the driver with a major and minor number? Or do platform device drivers also need a major and minor number?
If yes, When and How to assign it?
I guess, I'll be using platform_driver_register() for registering the driver.
You don't have to register major or minor numbers. Your question is actually not precise enough. Do you want to write a driver for a specific SPI flash or a driver for an SPI host?
If this is an SPI flash, what you want is to register your driver using a struct spi_driver with module_spi_driver() then in the probe, register your device in the MTD susbsystem using mtd_device_parse_register. The MTD susbsystem will register the major and minors for you.
If you need to write a driver for the host, then you will register your driver using a struct platform_driver and module_platform_driver(). In your probee you will register your hosts using spi_register_master
You should probably read a bit about the Linux device model for further explanations.