[STM32GENERIC] Latest – issues

Pito
Thu Jun 22, 2017 6:54 pm
I’ve updated my local repo copy as there came to a lot of developments in a few last days :)
I am currently messing with the BLUE 103ZE variant (see updated BLUE Boards variants in another thread) trying to build the SDCopy demo with F103ZE and SPI/Sdfat. So far I get
In file included from C:/Users/pito/MyCode/Arduino/hardware/Arduino_STM32SerBuff/STM32DE1/system/STM32F1/CMSIS_Inc/stm32f1xx.h:151:0,
from C:/Users/pito/MyCode/Arduino/hardware/Arduino_STM32SerBuff/STM32DE1/cores/arduino/stm32/stm32_def.h:10,
from C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32DE1\libraries\stm32_dma\src\stm32_dma.c:23:
C:/Users/pito/MyCode/Arduino/hardware/Arduino_STM32SerBuff/STM32DE1/system/STM32F1/CMSIS_Inc/stm32f103xe.h:12157:39: error: redefinition of 'DMA2_Channel4_5_IRQHandler'
#define DMA2_Channel4_IRQHandler DMA2_Channel4_5_IRQHandler
^
C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32DE1\libraries\stm32_dma\src\stm32_dma.c:268:13: note: in expansion of macro 'DMA2_Channel4_IRQHandler'
extern void DMA2_Channel4_IRQHandler() {
^
C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32DE1\libraries\stm32_dma\src\stm32_dma.c:262:13: note: previous definition of 'DMA2_Channel4_5_IRQHandler' was here
extern void DMA2_Channel4_5_IRQHandler() {
^

danieleff
Fri Jun 23, 2017 4:37 am
There is a also a pull request for those boards, and has a fix for this. Until then, just comment it out.

Pito
Fri Jun 23, 2017 11:12 am
Thanks. I commented the DMA out. Got then error with missing
#define __HAL_AFIO_REMAP_SPI3_DISABLE() CLEAR_BIT(AFIO->MAPR, AFIO_MAPR_SPI3_REMAP)

stevestrong
Fri Jun 23, 2017 4:24 pm
[Pito – Fri Jun 23, 2017 11:12 am] –
Could you try to run the SDcopy wih SPI on an F103 with your setup there, plz?

Libmaple core: BP, CPU@72MHz, SPI_1@36MHz, flash wait states = 1, BUFSIZE = 14kB (more does not fit into RAM):
#################################################
Opening the read file..
Opening the write file..
Reading and Writing..
File size = 102400000 bytes.
*************************************************
Done in 76582 msecs
*************************************************
Running CRC calculations...
*************************************************
*************************************************
File in CRC: 22BCDBEC
File out CRC: 22BCDBEC
*************************************************
Done in 253858 msecs


Pito
Fri Jun 23, 2017 5:31 pm
But under Generic?

Pito
Sat Jun 24, 2017 9:32 pm
Updated my local repo again with today’s latest changes..
After an hour coping with errors I finally added to compile options the new ARCH flag (Blue F103ZET, 72/18MHz, SPI, SdFatEX, Buf=32kB, 2MB file)
-DSTM32F1 -D__STM32F1__ -DARDUINO_ARCH_STM32

stevestrong
Sun Jun 25, 2017 9:11 am
And how is performing with a 102400kB file?

Pito
Sun Jun 25, 2017 11:35 am
[stevestrong – Sun Jun 25, 2017 9:11 am] –
And how is performing with a 102400kB file?

F103ZET, 72MHz, 18MHz SPI, flash ws=2, Buffersize = 32kB, SdFatEX, 104.4MB file, Samsung EVO CL10
Use a freshly formatted SD for best performance..
*************************************************
Opening the read file..
Opening the write file..
Reading and Writing..
*************************************************
Done in 135574 msecs
*************************************************
Running CRC calculations...
File in CRC: 22483A52
File out CRC: 22483A52
*************************************************
Done in 266093 msecs


Pito
Sun Jun 25, 2017 12:16 pm
This is the Sandisk at 18MHz SPI (36MHz SPI with the error as above) in the bench:
File size 5 MB
Buffer size 512 bytes
Starting write test, please wait.

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
1946.16,24128,254,261
1964.51,11305,254,258
1926.66,36394,254,263

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
1984.79,1155,255,256
1984.79,1154,255,256
1984.79,1155,255,256

Done


danieleff
Sun Jun 25, 2017 2:36 pm
The only thing changed lately that can affect SPI high speed is `smt32_gpio_af_F1.c` changed from
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
to
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;

stevestrong
Sun Jun 25, 2017 4:48 pm
For F1 one need “VERY_HIGH” (50MHz) GPIO speed, otherwise SPI@36MHz won’t work.

Btw, I think the GPIO speed setting was set to “MEDIUM” due to Pito’s recommendation for F4 SDIO to work.
Well, SDIO works for libmaple F4 with GPIO set to push-pull with enabled pull-up and the default push-pull speed “HIGH” (50MHz).


Pito
Sun Jun 25, 2017 6:13 pm

Btw, I think the GPIO speed setting was set to “MEDIUM” due to Pito’s recommendation for F4 SDIO to work.

Trust, but verify :)
Here with VERY_HIGH gpio speed at SPI 36MHz, Samsung:
Use a freshly formatted SD for best performance..
*************************************************
Opening the read file..
Opening the write file..
Reading and Writing..
*************************************************
Done in 89378 msecs
*************************************************
Running CRC calculations...
File in CRC: 22483A52
File out CRC: 22483A52
*************************************************
Done in 227120 msecs

Pito
Sun Jul 16, 2017 7:23 am
These are 2 issues I see here with USB with the latest (local repo updated here on 24.6.) on Blue F103ZET board:

1. with the latest when compiled for SerialUSB the SerialUSB console is not recognized by Win7.
The upload via DFU works.

2. The SerialUSB is recognized when compiled with my previous local repo version and it works, but with the TX speed issue (there is the old CDC ACM driver used – it has to be patched with Steve’s patch – https://github.com/stevstrong/Arduino_S … 7d2281eadb ).


danieleff
Sun Jul 16, 2017 1:14 pm
Does it work with bluepill?
Not recognized means the yellow triangle in device manager? If so, try changing the USBD_VID to 0x1EAF, and USBD_CDC_PID_FS to 0x0004

Pito
Sun Jul 16, 2017 1:37 pm
It does work with MapleMini and the latest, connected via COM4 STM32 Virtual port. I do not have BP handy today.
It does work with Black F407ZET and the latest, connected via COM4 STM32 Virtual port.
There is the USBSerial TX issue, however (82x slower than normal).

The Blue F103ZET and the latest – I get a bubble message “USB device not recognized” when inserted the USB, with “Unknown device” in the DevMan, none yellow triangle in the DevMan.


Pito
Sun Jul 16, 2017 4:40 pm
In the platform.txt there is several times used the flag

-DARDUINO_ARCH_{build.arch}


danieleff
Sun Jul 16, 2017 5:48 pm
Rename your STM32DE1 folder to STM32, the folder name is the way to distinguish between multiple archs.

I will not be able to fix the USB issue with F103ZET, it should work as the code is the same as F103C. The difference is only clock setup, and maybe it has a USB_DISC_PIN.


Pito
Sun Jul 16, 2017 6:22 pm
:twisted: You are right, I messed with clock settings in variant.c.. I had 7 there.. :cry:
Now the F103ZE connects.. Thanks.

What about the USBSerial Tx patch – your core is using different files as the libmaple, it seems..
I patched the libmaple core today – https://github.com/stevstrong/Arduino_S … 7d2281eadb
and the Tx speed went from 9k6 to ~1000k.. Your core is 9k6..

The -DARDUINO_ARCH flag – I think it is a bad idea to derive the architecture name based on the repo folder’s name.. :?
I will hard-wire it ARDUINO_ARCH_STM32 here in my platform.txt, as I am using 8 folders for various repos (and their different versions) here.
And Roger has in his libmaple the folders called STM32F1, STM32F3, STM32F4 in there – and the arch is ARDUINO_ARCH_STM32 (at least SdFat is using that flag).
Moreover, everything in stm32duino is _STM32 architecture.. :)


vitor_boss
Tue Aug 01, 2017 12:21 am
Serial.available() is not working properly.

My code use a lot of that to check list of commands, but it is currently return a Bool result instead number of bytes
Actual code:
int SerialUART::available() {
return rxEnd != rxStart;
}


Leave a Reply

Your email address will not be published. Required fields are marked *