This repository is a code bank for custom C libraries for IC components to reduce effort, time, and cost while increasing code quality and integrity. STM32Cube is an STMicroelectronics original initiative to ease the developers life by reducing efforts, time and cost.
This repository contains drivers compatible with the STM32F7xx series and requires the use of the STM32CubeIDE for code generation. This requires STM32 HAL to use. Coded in C.
- STM32F765
- MT25QL01 NOR FLASH MEMORY
Implement printf to utilize this driver. Must be using Trace Asynchronous Sw and SWO pin must be connected to your ST-LINKV2
- Open Run > Debug Configurations. Under debugger tab, enable Serial Wire Viewer (SWV).
- Enable ITM terminal by going to debug perspective. Window > Show View > SWV > SWV ITM Data Console.
- Find SWV Settings in the SWV ITM Data Console. Enable stimulus port 0 (rightmost checkbox).
- When debugging, click the red "record" (Start Trace) button on the SWV ITM Data Console window and printf statements will show as executed.
- syscalls.c must be generated by STM32CubeIDE for this to work.
- Go to main.c and insert the contents of printf.c as a private prototype function.
- You can now use printf() as normal in your code and expect the output to be in the SWV ITM Data Console.
This issue is a logical error in the first version of the code. The WriteNONVOL function has an issue in bit reversal which causes the register to go into an undetermined state. This can be fixed using the power loss recovery sequence.
- Create a new project.
- Configure SPI_SCK, SPI_MOSI (FM Pin DQ0), and HOLD Pin (FM Pin HOLD#/DQ3) as a GPIO_Output pin set to very high maximum output speed.
- Open NVCIssue_Fix_main.c and copy the clock_cycle function. Replace appropriate CS pin in the function.
- Copy the code inside the main function to implement the power loss recovery sequenece.
- Run / Debug the code. DO NOT use breakpoints. The sequence must be done in order without interruption.
- Go back to a working project where the SPI peripheral is properly configured. Extended SPI should be working and can be tested using MT25QL_ReadID() function.
- Run the MT25QL_ResetNONVOL() function onto the same flash memory using SPI. Use ReadNONVOL() function to verify if register value is reset to 0xFFFF.
Copyright (c) 2024 Wayne Akeboshi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
If there are any issues with the code or tested compatabilities with other microcontrollers, kindly let me know. Thanks