Spark Logic

HALMX :: MXBluePillF103C8 Roadmap

Vassilis Mon Apr 18, 2016 6:46 am

On March 2016 I started working on Sheepdoll’s (Julie S. Porter) great work on HALMX core files. I focused on STM32F103C8 MCU because it’s widely used by STM32Duino members. I think it is very hard for members to watch the whole forum posts and see what feature is added to the HALMX core.
I saw that Sheepdoll has a generic HALMX roadmap but the changes I have done so far are tested only MXBluePillF103C8 variant. Not to the entire HALMX variants. For that reason, I created this post that informs the members with the changes are made by me or any other member, to the MXBluePillF103C8 variant.

Things that work:

[14 May 2016]
* USBSerial. Added support to USB Virtual COM port.
* Bootloader. The Maple DFU firmware upload method is used to upload the compiled sketches to HALMX.

[09 May 2016]
* Added the interrupt based Serial transmission function on Serial1, 2 and 3 ports.

[19 April 2016]
* wiring_analog.c Support to AnalogRead() and AnalogWrite() functions

[14 April 2016]
* SPI library
* wiring.h The delayMicroseconds() was re-written for STM32. The previous assembly code wasn’t work correct to the tests I had made.
* wiring_digital.c The LOW and HIGH were placed in reverse on digitalRead(…). Fixed!

[09 April 2016]
* Hardware Serial ports. Serial 1, Serial 2 and Serial 3 work in Interrupt mode.

Things to do:
* Wiring library. Support to I2C interface
* SPI library in DMA and Interrupt mode.

Replies

stevech Wed Apr 27, 2016 8:02 pm

I don’t thing a delay loop for microsecond delay makes sense. It will be interrupted by systick et al.

The one that I’ve seen uses micros() which computes the inter-systick time using the real time counter value from the systick timer, and knows the systick timer clock speed.

But none the less, there’s always that pesky systick interrupt, usually every 1,000 microseconds.

GrumpyOldPizza Wed Apr 27, 2016 9:11 pm

stevech wrote:I don’t thing a delay loop for microsecond delay makes sense. It will be interrupted by systick et al.

The one that I’ve seen uses micros() which computes the inter-systick time using the real time counter value from the systick timer, and knows the systick timer clock speed.
.

Slammer Wed Apr 27, 2016 10:15 pm

The micros() function is part of arduino api and it is good to have it in our implementation. The function is not dedicated to delays, is a generic function and can be used for measurement of execution time of a procedure or any other purpose.

GrumpyOldPizza, nice code. I included in my Big Book of snipplets….

zmemw16 Thu Apr 28, 2016 7:13 pm

:?: long blurry day, why don’t i follow this line, it seems to be a potential race with the first line in the braces.

while (ms != HAL_GetTick());

racemaniac Thu Apr 28, 2016 7:17 pm

zmemw16 wrote:@racemanic did your bulk buy arrive (10off 1g) ?

stephen

zmemw16 Thu Apr 28, 2016 7:19 pm

apols, didn’t realize, truly long and blurry :oops:
srp

GrumpyOldPizza Thu Apr 28, 2016 9:01 pm

zmemw16 wrote::?: long blurry day, why don’t i follow this line, it seems to be a potential race with the first line in the braces.

while (ms != HAL_GetTick());

Slammer Thu Apr 28, 2016 9:02 pm

zmemw16 wrote::?: long blurry day, why don’t i follow this line, it seems to be a potential race with the first line in the braces.

while (ms != HAL_GetTick());

Vassilis Fri Apr 29, 2016 7:18 am

The SerialUSB library is almost ready.

RogerClark Fri Apr 29, 2016 7:54 am

@vassilis I merged the PR

I have one other PR https://github.com/rogerclarkmelbourne/ … M32/pull/7, but I’m waiting for a reply from @sheepdoll, as it may effect the Mac

We also have the code for micros() which needs to be manually merged as its not a PR

GrumpyOldPizza Fri Apr 29, 2016 12:56 pm

Slammer wrote:zmemw16 wrote::?: long blurry day, why don’t i follow this line, it seems to be a potential race with the first line in the braces.
Thanks GrumpyOldPizza for clarify this…. yes, this value is changing very fast. I am not sure if the two nops are required…. No big difference anyway.

sheepdoll Sat May 07, 2016 1:02 am

I think I found out why I was unable to run my Nuleo F103RB from the laptop running OS X 10.10.5

When I compared the build download output to the OS X 10.7.5 I found that the file startup_stm32f103xb.s was not being included. I noticed that on the 10.7.5 the suffix was uppercase ‘S’ changing this on the 10.10.5 machine the blink sketch ran.

I noticed that in the platforms.txt file the recipe for assembler is uppercase ‘S’ I also notice that on the F4 variant I had copied this file to the top of the variant tree and must have renamed it as there is both a file with a small ‘s’ in the drivers..gcc path and the one with the uppercase ‘S’ that is peer to variant.cpp and the .ioc file. So I must have run into this before and forgot about it.

RogerClark Sat May 07, 2016 2:12 am

@sheepdoll

I think @vassilis has a windows bat file which changes the case of assembler file extension (Or perhaps it was a script, I definitely remember seeing a script that changed it)

Slammer Sat May 07, 2016 12:18 pm

I have same issues with UARTs. The code of HALMX does not handle IRQ transmits in a way compatible with arduino core lib, actually the core sends the bytes one by one taking no advantage of IRQ nature of HAL. Some rework is needed but I will wait Vasilis to finish a “batch” of his work before any modification.

Vassilis Sat May 07, 2016 9:08 pm

I will try to finish the interrupt based serial transmission as soon is possible.

stevech Sat May 07, 2016 9:21 pm

Slammer wrote:I have same issues with UARTs. The code of HALMX does not handle IRQ transmits in a way compatible with arduino core lib, actually the core sends the bytes one by one taking no advantage of IRQ nature of HAL. Some rework is needed but I will wait Vasilis to finish a “batch” of his work before any modification.

Slammer Sat May 07, 2016 10:13 pm

Yes stevech, you are correct, UART transmission via DMA/IRQ is simple and correct as you know the data length, the problem is that arduino api calls the transmission function to send only one byte at a time making the DMA/IRQ useless as the next byte transmission waiting the previous to complete (at least with the current HALMX implementation).

Vassilis Mon May 09, 2016 3:44 pm

Is added the Interrupt based transmission function on Serial1, 2 and 3 ports.
I sent a PR to Roger.

stevech Mon May 09, 2016 7:58 pm

Slammer wrote:Yes stevech, you are correct, UART transmission via DMA/IRQ is simple and correct as you know the data length, the problem is that arduino api calls the transmission function to send only one byte at a time making the DMA/IRQ useless as the next byte transmission waiting the previous to complete (at least with the current HALMX implementation).

Slammer Mon May 09, 2016 10:31 pm

Arduino’s “gate” to lower routines (eg. HAL transmit) is the write function, which passes only one byte to transmit function. Any higher level routines like writeln(string) calls multiple times the write function sending bytes one by one.
Normally the write function “pushes” a byte to the ring buffer and triggers manually the transmit interrupt if the transmission is inactive. A next call of write function simply pushes a new byte to ring buffer if the previous is not completed. The irq transmit function checks the ring buffer and if is not empty sends the next byte. With this way every write takes only the time of pushing the byte into the ring buffer ( less than usec in our case) and the transmission is actually a chain of transmits initiated by first write and controlled by irq function itself, of course, somewhere there is a check to avoid overflow of buffer (eg. the write checks if buffer is full and if it is, waits or discards the new byte).

PS. I didn’t check the new version yet…

Sign in to reply