STM32, Maple and Maple mini port to IDE 1.5.x

Hello, I fooled around with the Winbond FlashRAM chip (W25Qxxx) and got crazy about it's behavior while writing/reading. Short end of the story (yes, read the datasheet first!): You must erase each sector, before you rewrite it again! That means one sector on my chip is about 4096 bytes (4Kb), so even when I'll rewrite only 256 bytes, I've to erase the whole sector. This is not necessary if there was no writing to the adress before, example: Write 256 bytes to adress 0-255 (do something other...) write 256 bytes to adress 512-768 (do something other...) write 256 bytes to adress 256-511 these steps are ok, because no adress was written before, but you can't do that: Write 256 bytes to adress 0-255 (do something other...) write 256 bytes to adress 0-255 The result will be garbage. So without sequential writing you have to implement an temporary 4096byte buffer -> read out the whole sector, erase it an combine the new data with the buffer and write the whole sector. This can be a drawback, because you need 4kB in reserve (temporary), not nice for a 20kB device :/

Matthias,

Thanks for the information on the Flash chip.

I only have that chip on the back of a F103ZET board, but luckily the ZET chip has a lot more memory (I think it may be 64k ram, but I can't remember exactly)

But as you say... On the Maple mini or any other F103C8 or F103CB device, 4 k is a big block of memory.

turkogluky: @Roger

Hi, I am working on maple mini baite colon. Performance is good. Your porting to arduino ide is working great. ( 1.6.1 ) Something! I am having problem with oneWire example. When I upload it, board is blocking. Only I can resolve with bootloder mode. As uploading different sketch. So I cannot use DS18B20 device. Is this problem specific to my site? Any help appreciated.

Are you using 2 or 3 wire interface to the DS18B20 ?

I used 3 wires, (Separate power)

What pullup resistor did you use ? I used 4.7k, which I think is normal even for 5V.

What length of wire are you using. I only tested on a 1m long cable

Sadly my thoughts on a workaround doesn't work: I read in the datasheet the adress must be set to "FF", so I tried to write a "FF" to each ad. before writing the real data, no luck. BTW: I have done a library translation for the winbond, but there are some errors I've to correct before I'll upload it to forum.

Hi Matthias

OK

No worries.

I am so busy on other things, I don't think I will have time to test on my ZET board at the moment (and at the moment I'm not entirely sure how the Flash is physically connected e.g. which pins )

@Roger

Yes I am using 3 wire,4,7k , no cable. Arduino uno is working. I am using your hardware\stm32... library. What is the importance of the pin number that I am using for ? What is the correct pin ? If this DS18B20 example is working with your set. I will work on at my site. Thanks.

Mustafa

@turkogluky

What is the correct pin ?

It uses GPIO so any pin should work

If this DS18B20 example is working with your set.

Yes. From what I recall it was working

I think @mrbrunette may have tested as well

I don't have the DS18B20 wired to my test board at the moment, but I will connect it later and confirm its working

PS. What board are you using ? Maple Mini ?

turkogluky:
@Roger

Hi, I am working on maple mini baite colon. Performance is good.
Your porting to arduino ide is working great. ( 1.6.1 )
Something!
I am having problem with oneWire example.
When I upload it, board is blocking.
Only I can resolve with bootloder mode. As uploading different sketch.
So I cannot use DS18B20 device.
Is this problem specific to my site?
Any help appreciated.

I have recently used a BMP180 with Baite Maple Mini but have not s:pecifically used the DS18B20; although I may have one to test IF it can be found. IF I can, I will report it in this thread.

I have a few Maple projects here that are all working as expected.

Ray

@Roger

The sdfat library in this repository was working fine with DMA in the library, still not using your new SPIDMA, but I can't get anything working now, so I suspect it is my sdcard rig. https://github.com/victorpv/SdFat

Can you test that and see if it works reliably for you? I mainly tested the sdinfo and bench examples. The first one just shows information of the SD card, the second runs read and write test, and a couple of weeks ago it was working fine for me all the time, now it's not working at all.

If that works reliably for you, I'll pass you the modification I was doing to use the new SPIDMATransfer, so you can see if that works too.

Victor

OK. I'll download and test, but I won't be able to do it until later today.

Thanks

Roger

Ray

DS18B20 uses OneWire doesnt it ? rather than I2C for BMP180 ?

Last time I tried it, OneWire was working, as I was the one that ported it, (with help from everyone) ;-)

UPDATE:

@Roger: So, I used a Nano to prove the DS18B20 was working; the 4.7K pull-up was required at 5V. I installed a working STM32 Maple Mini clone tested with my blink-count script. When I went to the \Documents\Arduino\hardware\STM32\STM32F1\libraries\OneWire\examples\DS18x20_Temperature script, it would not compile on my Windows 8.1 box. The error was traced to the fact that for some crazy reason, the OneWire lib was being pulled from: \Documents\Arduino\libraries\OneWire\ and not from \Documents\Arduino\hardware\STM32\STM32F1\libraries\OneWire\

I fixed that by including the entire path:

include "\Documents\Arduino\hardware\STM32\STM32F1\libraries\OneWire\OneWire.h"

The program compiled: (1.6.1 shipping)

Sketch uses 15,388 bytes (14%) of program storage space. Maximum is 108,000 bytes.
Global variables use 4,528 bytes of dynamic memory.

HOWEVER: The instantiation of OneWire causes the uC to either freeze or appear to freeze. Pressing RESET goes into DFU but when the user program starts, nothing. Worst, the COMn port does not enumerate on Windows, so no debug output.

I changed Serial. to Serial1. and got a clean compile, but again, OneWire freezes the uC.

Ray

rogerClark: Ray

DS18B20 uses OneWire doesnt it ? rather than I2C for BMP180 ?

Last time I tried it, OneWire was working, as I was the one that ported it, (with help from everyone) ;-)

Yes, you are correct. I went down to the dungeon last night and found one of the DS18B20 which is encapsulated in the long cable and terminates into a stainless steel cylinder. I cannot remember ever using it (I have 2 for some strange reason), but I'll try it today if time permits. I suspect the library that Op used is the issue.

Ray

Hi guys If you want to fix the compiler issues with 1.6.2 and 1.6.3, check out my comment on issue #39 It's reply #5, at the bottom. I don't have a maple :( but I am planning on getting one as soon as possible.

-Isaac

Hi Roger & forum,

This afternoon I have soldered up another one of my prototype PianoForte boards this time with the STM32F103RC processor. This is the one with 256K of flash and 48K of RAM. It was only a few cents more than the RB - and seemed much better value with twice the flash and more than twice the RAM.

I got blink working first, with the LED on PC13 and then went for a home-spun program that I call SIMPL *.

It’s a kind of minimal interpreted language that runs on the '103 - allowing you access to the hardware from a few serial commands over the PA9/PA10 USART1. I use it on regular AVR based on Arduinos, and also on the FPGA ZPUino. This all works too!

In its minimum built up form, the board has just the processor, the crystal, the reset and boot switches, the FTDI programming connector and about 10 small surface mount resistors and capacitors.

I’m very pleased that I now have a home produced board, which from scratch can now make full use of Arduino_STM32 on the STM32F103 series.

Ken

  • SIMPL is a “serial minimal interpreted programming language” based on the Txtzyme interpreter by Ward Cunningham. I have adapted it so that I can manipulate the ports, read ADCs, generate PWM and tones all using a few alphanumeric commands. Commands can be strung together to make compound commands that can be executed from RAM.

Ward’s original Tytzyme (and Arduinozyme) is here GitHub - WardCunningham/Txtzyme: DIY DSL Interpreter for Teensy (Arduino-like) Controllers

mrburnette: UPDATE:

@Roger: So, I used a Nano to prove the DS18B20 was working; the 4.7K pull-up was required at 5V. I installed a working STM32 Maple Mini clone tested with my blink-count script. When I went to the \Documents\Arduino\hardware\STM32\STM32F1\libraries\OneWire\examples\DS18x20_Temperature script, it would not compile on my Windows 8.1 box. The error was traced to the fact that for some crazy reason, the OneWire lib was being pulled from: \Documents\Arduino\libraries\OneWire\ and not from \Documents\Arduino\hardware\STM32\STM32F1\libraries\OneWire\

I fixed that by including the entire path:

include "\Documents\Arduino\hardware\STM32\STM32F1\libraries\OneWire\OneWire.h"

The program compiled: (1.6.1 shipping)

Sketch uses 15,388 bytes (14%) of program storage space. Maximum is 108,000 bytes.
Global variables use 4,528 bytes of dynamic memory.

HOWEVER: The instantiation of OneWire causes the uC to either freeze or appear to freeze. Pressing RESET goes into DFU but when the user program starts, nothing. Worst, the COMn port does not enumerate on Windows, so no debug output.

I changed Serial. to Serial1. and got a clean compile, but again, OneWire freezes the uC.

Ray

Yes, you are correct. I went down to the dungeon last night and found one of the DS18B20 which is encapsulated in the long cable and terminates into a stainless steel cylinder. I cannot remember ever using it (I have 2 for some strange reason), but I'll try it today if time permits. I suspect the library that Op used is the issue.

Ray

Ray

I will dig out my DS18B20 and reconnect it, as I'm sure I did get it to work. However I normally use a generic stm32f103c8 board rather than a maple mini. So there may be some difference.

guinnessimo: Hi Roger & forum,

This afternoon I have soldered up another one of my prototype PianoForte boards this time with the STM32F103RC processor. This is the one with 256K of flash and 48K of RAM. It was only a few cents more than the RB - and seemed much better value with twice the flash and more than twice the RAM.

I got blink working first, with the LED on PC13 and then went for a home-spun program that I call SIMPL *.

It's a kind of minimal interpreted language that runs on the '103 - allowing you access to the hardware from a few serial commands over the PA9/PA10 USART1. I use it on regular AVR based on Arduinos, and also on the FPGA ZPUino. This all works too!

In its minimum built up form, the board has just the processor, the crystal, the reset and boot switches, the FTDI programming connector and about 10 small surface mount resistors and capacitors.

I'm very pleased that I now have a home produced board, which from scratch can now make full use of Arduino_STM32 on the STM32F103 series.

Ken

  • SIMPL is a "serial minimal interpreted programming language" based on the Txtzyme interpreter by Ward Cunningham. I have adapted it so that I can manipulate the ports, read ADCs, generate PWM and tones all using a few alphanumeric commands. Commands can be strung together to make compound commands that can be executed from RAM.

Ward's original Tytzyme (and Arduinozyme) is here https://github.com/WardCunningham/Txtzyme

Ken

Sounds great.

At the moment support for R series is limited. The Maple is an RB, and I added a generic RC board to the repo, but there are issues with the RC board variant where some GPIO pins don't work.

I have not had time to track down whether I did something wrong in the files in that board variant, or whether the issue is something to do with that the RC and RE etc boards are higher density than the C8 and CB, as various bits of code is only enabled for higher density devices. E.g it could also be an AF remap issue.

So the moment I tend to use my old faithful "Stm32 to flash" board type.

Isaac96: Hi guys If you want to fix the compiler issues with 1.6.2 and 1.6.3, check out my comment on issue #39 It's reply #5, at the bottom. I don't have a maple :( but I am planning on getting one as soon as possible.

-Isaac

Does this work with 1.6.0 and 1.6.1 etc

Re other gcc.

Yes. All that stuff is broken and has been for a while. I need to remove it. It was added by Alexey @hiddenpilot, but I think he must have other compilers installed, so I will put its removal on my to do list

Ray

I just tried OneWire on my Maple, attaching it to pin 10, and it did not work :-(

I've looked it up to my generic STM32F103C8 board and it works.

I connected it to PA4 and PA3 independently and it worked on both those, and as far as I can tell from the Maple wiki, pin 10 on the Maple is PA4.

I checked what voltage I was using and it is 3.3V though a 4.7k

One thing I have noticed even on the generic STM32 board, is that the constructor is prone to hanging if there isn't anything connected to the pin in question

In case it was an issue with dual use of pins, I moved it to pin 15 on the Maple, which appears to be totally free of other uses, but it still hung

I'll need to debug into the constructor, to see why its fine on a generic board but is probably getting stuck in the contructor on Maple and Maple mini

Guys,

I’ve taken a look at OneWire, but there is something strange going on.

Any calls to the hardware from inside OneWire.cpp cause the board to crash.

So the call to set pinMode in the constructor crashes, and if I put a call in to digitalRead it also crashes as does Serial.print().
In fact if I put Serial.print() into the constructor it crashes and repeatedly reboots !

I can’t see any easy way to debug this, apart from disabling large sections of the header and the CPP and seeing which bit just by its existence breaks things

Edit.

Even more strangeness

I’m not sure if my machine is really playing up, but I was using the version of OneWire from the general libraries folder, not the one from the STM32 folder (even though they were the same files)

So I removed the one from My Documents/Arduino/libraries to just use the one in STM32F1/libraries, but for some reason the IDE won’t pick up the OneWire library all

e.g. #include <OneWire.h>
should call in the library (its a special trick in the IDE) but its not seeing it as a library

I’ve double checked and as far as I can tell I don’t have any other rogue copies of the library lying around,

the general libraries folder, not the one from the STM32 folder (even though they were the same files)

@ Roger,

Yes, I have been having inconsistent issues with the GUI picking the right library filrs. I thought I had it figured out, but doing today's compiles left me still scratching my head.

Ray