Dear,
I have compiled the latest of mpy and flashed it into the STM32L476DISC board.
I once had it working, Flash drive and all, but after erasing and updating again it did not work anymore.
There is some odd behaviour (not related to the version 1.9.4).
No connection to the microUSB and using the REPL via the ST-LINK UART shows the MPY 1.9.4. prompt.
If I connect the USB to the microUSB port too then the board starts to reset itself every few seconds.
No drive or CDC UART appear.
DFU uploading of firmware.dfu is without any problems so it seems to be a run time problem with the code.
Anyone seen this behaviour before?
Some thing that could be a cause and part of the search...:
Is it possible due to a Flash Erase that option bits are "lost"?
Is it behaviour that is related to the LSE (32768kHz)/HSI (4MHz)
Is it the watchdog in relation with LSE/LSI?
Stray interrupt/watchdog from USB code?
Any pointers?
STM32L467DISC port not working?
-
- Posts: 363
- Joined: Sun Apr 17, 2016 1:55 pm
Re: STM32L467DISC port not working?
I think there are some configurature may not correctlly, do you change some configurature? I will test last version of uPy in STM32L476DISC soon.
Re: STM32L467DISC port not working?
I have it working now.
It seems that the dfu-util/bootloader via USB experiences some problems.
It does load w/o any errors, but the code does not run as expected:
- constantly rebooting when USB cable attached
- when USB removed REPL via UART can be used, however no file system, crashes randomly when trying to use something from some libraries.
Eventually ended up using JTAG to flash the firmware.hex and it is working as expected.
Why not immediately used JTAG? Well, using the F405, F407, F439 in the same way all worked w/o a problem...
Lost a day, learned a lot.
It seems that the dfu-util/bootloader via USB experiences some problems.
It does load w/o any errors, but the code does not run as expected:
- constantly rebooting when USB cable attached
- when USB removed REPL via UART can be used, however no file system, crashes randomly when trying to use something from some libraries.
Eventually ended up using JTAG to flash the firmware.hex and it is working as expected.
Why not immediately used JTAG? Well, using the F405, F407, F439 in the same way all worked w/o a problem...
Lost a day, learned a lot.
Re: STM32L467DISC port not working?
I am working withthe L476 now.I just flashed mine, and there is something a bit wonky. I got the filesystem shown, but it showed on the host as a 17 Mb filesystem, which is obviously wrong.
The filesystem also only had boot.py on it. No main.py or other files that normally show up. It also had a label of 2821-0000 rather than PYBFLASH.
@dhylands I have tested my Discovery board with 1.9 and it works with internal and external flash with no code changes needed. The external flash is 128Mbit so 16Mbyte is correct. Internal gives about 500kbyte.
The initial external flash filesystem only has boot.py and wrong label as you reported. Resetting the filesystem fixes the problem. It might be due to whatever ST load into the flash.
I mapped LED3 (yellow) to the red led so you can see the boot sequence count when pressing USR. Releasing USR during 3 (gr + yel) resets the file system and it then pops up with the usual 4 files and PYBFLASH volume name. I copied a 3.5Mbyte file to it and could open it correctly. After resetting it once the filesystem has been reliable.
@roland_vs Have you had success with ST-LINK programming. There is a bug in the L4xx bootloader that will not program the flash properly unless the binary image is 8 byte aligned. Your symptoms could well be due to partial or corrupt flash programming.
Re: STM32L467DISC port not working?
It works, however using JTAG to program the image rather than dfu-util, the aforementioned "patch" combined with the randomness of dfu-util showed that it worked, but was not the root cause.
So if I have time I will check other "dfu" programs (like python version) to see at which side the problem resides....
So if I have time I will check other "dfu" programs (like python version) to see at which side the problem resides....
Re: STM32L467DISC port not working?
To be complete:
The difference between working and not working is entirely due to the 8-byte alignment of the generated code of the L476 port. If you use DFU-UTIL to program the firmware.dfu you may run into problems when the file is not padded to fulfil the mentioned need. AN2606 of STM for further info. Also on the forum site of STM you can find an utility HEX2DFU.exe that will do the padding. Then the programming via the USB interface works OK.
Note: The port is still not "complete" as the I2C is different (HAL) and the DAC also. Try this by enabling the Accelerometer and DAC modules in mpconfigboard.h. Also the RTC is not running (other post). On the wish list would be a LCD driver for the segmented display of the STM32L476DISCO.
The difference between working and not working is entirely due to the 8-byte alignment of the generated code of the L476 port. If you use DFU-UTIL to program the firmware.dfu you may run into problems when the file is not padded to fulfil the mentioned need. AN2606 of STM for further info. Also on the forum site of STM you can find an utility HEX2DFU.exe that will do the padding. Then the programming via the USB interface works OK.
Note: The port is still not "complete" as the I2C is different (HAL) and the DAC also. Try this by enabling the Accelerometer and DAC modules in mpconfigboard.h. Also the RTC is not running (other post). On the wish list would be a LCD driver for the segmented display of the STM32L476DISCO.
Re: STM32L467DISC port not working?
Try modifying tools/dfu.py. Around line 42 you should see:
Add these 2 lines:
to make it look like:
Code: Select all
for image in target:
tdata += struct.pack('<2I',image['address'],len(image['data']))+image['data']
Code: Select all
pad = (8 - len(image['data']) % 8) % 8
image['data'] = image['data'] + bytes(bytearray(8)[0:pad])
Code: Select all
for image in target:
pad = (8 - len(image['data']) % 8) % 8
image['data'] = image['data'] + bytes(bytearray(8)[0:pad])
tdata += struct.pack('<2I',image['address'],len(image['data']))+image['data']