I've would like to check whether STM32 Workbench works properly or not.
So, I've created new project for my F7 Discovery. I am using the HAL library and also enabled FreeRTOS. As FreeRTOS needs an independent timer, I enabled TIM1 for HAL and SysTick works for FreeRTOS.
Unfortunately, while debugging the project in Workbench, the program each time ends in the TIM1 interrupt routine, again and again, but I did NOT set any breakpoints here. How can I debug my code if everything I can see during debugging is TIM1 ISR?
As I understand it this is a feature of the r0p1 M7 core. ST only licensed the r0p1 core. Unsure if newer versions or model of the chip will be any better.
I read on another forum that this could perhaps mitigate the problem:
(DBGMCU)->APB1FZ = 0x7E01BFF;
(DBGMCU)->APB2FZ = 0x70003;
Related
I am currently working on a project using the TLE493 HAL sensors.
As controller, I use the STM32F303CT.
Now here comes the confusion when I use the ST HAL Libraries:
while(!SENSOR_OK) {
HAL_Delay(5);
ret = HAL_I2C_Master_Receive_IT(&hi2c1, TLE493_ADDR, rbuffer, sizeof(rbuffer));
// some more configuration
When I use a HAL_Delay 5ms, the I2C communication with the sensor works properly. Without it, I get HAL_BUSY as return value of the HAL I2C function.
Do I miss some point here or is the HAL library kinda messed up?
Btw: I am using the ST Motor Control workbench as well on this controller. Maybe this disturbs my function in any way.
Thank you for your answers
Cheers
Jimmy
There could be many reasons why the I2C needs the delay. Setup time by the chip or the I2C controller come to my mind for example.
The HAL Library offers the function HAL_I2C_IsDeviceReady to check if the device is ready for communication, you should probably look into that function.
Best regards
Dariusz
we have system which runs on NXP KE06 chip (MKE06Z64VLH4). It's stationary system, which was developed from primary company, which is not interested in quick bug fixing (there is a lot of bugs) and further development.
Now we have a job to solve a problem, without primary company. We have right now 200 products all over the country. If we want to update mentioned NXP chip, we need to travel to destination, take machine apart,
make and update for NXP chip over SWD (.HEX file) manualy and assemble each machine together again.
We have our controlling system on Raspberry, which is running Raspbian and we have RS-485 half-duplex connection between Raspberry and NXP chip. (which connection continues to CAN --> NXP chip)
We want to solve this problem with software and with current hardware. (With changing all current hardware, with new hardware solution, solves the problem)
Question:
Is possible to make an "remote" updater/flasher with .HEX file, and with current hardware?
FACTS: - we can't ask company for source code
- we have current .HEX file
- we don't want to replace all hardware (200+ pieces)
- we don't know the source code
Is possible to make an "remote" updater/flasher with .HEX file, and with current hardware?
No, because for that to be an option, the MCU must already have a bootloader alternative inside itself.
NXP hates their customers, so they block anyone from reading the manual without logging in... I managed to eventually get it. There is no mentioning of on-chip bootloader support save for SWD. The part can only be programmed by SWD or by a custom bootloader that you'd have to develop.
UART-based bootloaders are not uncommon - you could write one yourself using either UART/RS-485 or CAN, but then you'd have to update the firmware to download the bootloader, so it isn't helpful in this case.
Summary: you need something with SWD on-site or it can't be done.
Also please note that these MCUs typically have anti-copycat protection enabled, preventing you from reading anything out of it. Depending on how they were programmed, this could be present and then the only thing you can do is to erase and flash the whole program.
First of all: I'm using the CubeIDE toolchain offered by STM.
Some of the STM32 microcontrollers have multiple ADCs (for example STM32F446xx) and offer a multi-regular-simultanuous mode (DualMode or even TripleMode), where the ADC1 is set as a master and triggers the other ADCs, which are in slave configuration.
When I use this configuration in the CubeIDE I can still set the trigger for the ADC1 to a timer, and not use it in continuous mode. Does this configuration make any sense? I could also just set the trigger for all the ADCs I want to be synchronized on the same timer, no?
So the way I understand it, multimode only makes sense, when I want to have it running in continuous conversion mode and have all the ADCs be synchronized.
I'm having trouble with i2c communication. In my i2c bus, i have 4 boards (STM32L4 Sensortiles) and sometimes one of them blocks the bus and the others stop communicating consequently. When I reset that one that blocks the bus, all boards starting working again.
In my debugs, this bug happened when HAL_I2C_GetState(&hi2c3) returns HAL_I2C_STATE_BUSY_RX, even my others i2c functions HAL_I2C_Slave_Receive_IT and HAL_I2C_Slave_Transmit_IT returns HAL_OK:
Any ideas what Im doing wrong? Thanks.
Using libraries like HAL leads to problems like this one. Why?
HAL users feel free from knowing your hardware as magic library will do everything for you.
HAL users usually do not know how the peripheral works and how to debug it.
HAL users do not bother to go through the magic HAL function to see what the problem is.
Posting some images form debugger will not help.
What you need to do:
Get even the cheapest logic analyzer (there are $10 on ebay) and record the communication. See if the slave keeps the clock or data line low. If yes toggle the clock pin 9 times to unblock the line
If nothing helps reset the I2C peripheral using RCC register (it has to be implemented on all connected boards).
I encountered the following issue while using Keil MDK 5 for STM32H743.
I had a communication problem with my SPI code and after a while I found out that it was due to the Periodic Windows Update.
When it is activated, it seems that the debugger is reading regularly the SPI data register, which reads the FIFO (so changes the state of the FIFO). Consequently when the software reads the FIFO, some bytes have been "lost" (or consumed by the debugger).
Is it an expected behaviour ? Do you know if it is due to Keil or to the STM32 ?
I don't fully understand how an access from the debugger to a register is working: I guess there is a read command sent over SWD but then, internally does the access to memory go through AHB / APB like for code executing on the CPU ?
Any registers that modify behaviour by being read (such as clearing status bits) can be problematic when debugging and the registers are shown in the debug window.
The best bet is to only look at the registers when you stop (close the DR window for the peripheral), and always be aware that you may clear status bits etc.
It is the way the processor works and nothing to do with the debugger.
It is a very common debug issue with serial comms etc.
if you have DR display in your watch window (or any other similar windows on the debugger screen) and you step through the code every time you step (or generally break) the data is read.
That is the only possible reason.