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

Hi Victor

Thanks

I'll download and try that one and see how it stacks up against the other one

Looking at the one I forked and modified, it looks like its based on an older version of Arduino, a bit like libmaple

e.g. Hardware Serial class is derived from the Print class rather than the Stream class

I have been messing around with the one I forked and have made some minor improvements like adding Serial.begin which did nothing in the current version

However I've not pushed that change to the repo yet, as I was just trying to tidy up the way the setup and loop stuff is handled

I will push later

Victor and Ray

Looking at the repo that Victor linked to, it appears to be better than the one I cloned, however I'm not sure how the actual compilor (toolchain) is installed for GitHub - esp8266/Arduino: ESP8266 core for Arduino

GitHub seems to be experiencing some issues, at least for me at the moment, where its not serving pages correctly and its also packed up half way though a download / clone

So I'm cloning again and also downloading the Windows "release" zip file to see whats in that, because I can't see the exe in the normal fileset

Victor and Ray

OK...

I've spent some time looking at both repo's and the one that Victor found

I believe is the better of the two

However you need to download the Windows ZIP and its a complete replacement of the whole of Arduino 1.6.1 !

I've had a quick look at doing what I did to the other repo, i.e split out the hardware files and the tools (binaries) and move them to the user hardware folder, where they belong, but its now getting on for 10pm here and things are not working and frankly not making a lot of sense :frowning:

So.

I'd recommend you guys not download my version at the moment and try the one that Victor found instead.

If I get time tomorrow, I will see why I can't move the toolchain binary to the tools folder, (I get an error about the compilor mssing a DLL). I suspect that there is a difference in the way the two toolchains were built.

I've tried to use the toolchain from arduinoesp with the files from GitHub - esp8266/Arduino: ESP8266 core for Arduino]GitHub - esp8266/Arduino: ESP8266 core for Arduino however I get all sorts of compile errors, and although I've tried to update the compile flags, its not worked :frowning:

Its a shame, because GitHub - esp8266/Arduino: ESP8266 core for Arduino has better cores files than the one than the http://www.arduinesp.com (which I forked and modified), but GitHub - esp8266/Arduino: ESP8266 core for Arduino uses the older ESP IOT SDK. and GitHub - esp8266/Arduino: ESP8266 core for Arduino seems harder to move to the user's hardware folder

I suspect it will be possible to move the GitHub - esp8266/Arduino: ESP8266 core for Arduino version to the user's hardware folder, but I may need to duplicate some general purpose gcc files that are already in the IDE
like libiconv-2.dll

So. I guess I'll see how you guys have got on when I awake bright and early tomorrow morning :wink:

Cheers

Roger

PS. I will get back to the STM32 SPI DMA tomorrow.

rogerClark:
Victor and Ray

OK...

I've spent some time looking at both repo's and the one that Victor found

GitHub - esp8266/Arduino: ESP8266 core for Arduino

I believe is the better of the two
<...>

Got it.
Thank's to you and Victor... I've had the modules for a few months and do not have a project in mind, but did want to play. So, from what I understand, you own need for IoT is far more important than my play. I'm comfortable taking things at whatever your speed is, no rush!

Ray

UPDATE: (about 2 hours later...)
I did a full ZIP install of the 1.6.1 files + ESP8266 from ZIP.
As Murphy would have it, all the examples error. This is the same
1.6.1 that works with STM32 although I do have 1.6.2 nightly beta installed
for testing.
Hardware: Intel core-2 Duo 4G RAM 64-bit Windows 8.1 installation

Error is non-descript: Indentation is one long line....

Arduino: 1.6.1 (Windows 8.1), Board: "Generic ESP8266 board"

Using library ESP8266WiFi in folder: C:\Program Files (x86)\arduino-1.6.1\hardware\esp8266com\esp8266\libraries\ESP8266WiFi 



C:\Program Files (x86)\arduino-1.6.1/hardware/tools/esp8266/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -I
	C:\Program Files (x86)\arduino-1.6.1/hardware/tools/esp8266/sdk
	//include -c -Os -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -std=c++11 -MMD -DF_CPU=80000000L 
	-DARDUINO=10601 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -I
	C:\Program Files (x86)\arduino-1.6.1\hardware\esp8266com\esp8266\cores\esp8266 -I
	C:\Program Files (x86)\arduino-1.6.1\hardware\esp8266com\esp8266\variants\esp01 -I
	C:\Program Files (x86)\arduino-1.6.1\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src 
	C:\Users\Ray\AppData\Local\Temp\build1785729632592325968.tmp\WiFiScan.cpp -o 
	C:\Users\Ray\AppData\Local\Temp\build1785729632592325968.tmp\WiFiScan.cpp.o 

Error compiling.

I'm going to try later today to install on another box that is running 16-bit Windows 7 and has never had Arduino installed.

Ray

I got that message as well.

I tracked it down to gcc not being able to find libiconv-2.dll but I presumed that I'd managed to break the files somehow by trying to move the hardware files out of that installation

But I did a rebooot and unzipped again at about 10pm last night and it still didn't work, so I gave up for the day.

I could have sworn that initially when I unzipped the package it worked ok, but it was getting late by the time I started looking at it, so I could have been mistaken.

But perhaps the download zip files are indeed broken.

I didn't try compiling for AVR, which I think I should have done

It will be easier to get working in the correct location e.g. The hardware folder if it is indeed a problem with that copy of the IDE

Ray.

I just took a look again, and it does compile for the UNO with that file set, just not for xtensia

So they seem to have stuffed up the compiler installation

If you want to just check whether your board could work with the arduino IDE you could download my version, because at least it compiles

However in the longer term the one from ESP8266 Community Forum · GitHub is undoubtedly better in many ways

I'm going to see if I can fix the compiler issue by using the compiler from my version, and just as a matter of interest I will try installing on an old Windows XP machine I keep for regression testing.

Edit.

After a lot of messing around I can get the better version to compile, but it now worn't run the uploader :frowning:

So unless you are desperate to play with the ESP8266 this weekend, you'd probably be better off doing something that doesnt require your to tear your hair out :wink:

And I'll wait for the author of the repo to fix whatever is wrong. (I've posted a couple of issues to github)

FYI:

I just received 10 nicely packed $4 Maple Mini Boards... time in shipping 22 days. Vendor

I just opened one of the AS-bags and the board did not have any uC rework or reflow (or, if it did the flux was cleaned.) It comes with the headers and appears to be pristine. This is contrary to the eBay 'cheapies' I got back at the end of last year and is consistent with the quality of the order I received directly from the Baite online shop.

Note to readers: My experience may not be identical to your experience, Statements are not an endorsement for product or vendors.

Ray

Hi Ray

How do I tell if a board has been reflow'ed, are you looking for signs of flux etc ?

$4 US does seem to be the cheapest deal I've seen anywhere, but I guess it depends on exchange rate.

eBay's cheapest to me are $4.14 USD equivalent, but I find buying on eBay somewhat less hassle than AliExpress, so if the boards are of similar quality, I expect I'll stick with eBay :wink:

Ray and Victor

I must be a glutton for punishment, as I've finally managed to reconfigure the better ESP8266 repo to work without needing to download the whole IDE

But like the otherone, the toolchain is quite large (400mb uncompressed)

I've just been having a discussion with someone on GitHub, and hopefully I may be able to presuade them to re-configure the main repo to do it properly

Edit

OK. I'm pushing my new version now. But like yesterday its going to take a while

But it should be there by the time you guys in the east coast get up tomorrow :wink:

PS. I'm not sure where Victor_PV is located.
Victor, I suspect you are West coast or central, or you are a night owl :wink:

rogerClark:
Hi Ray

How do I tell if a board has been reflow'ed, are you looking for signs of flux etc ?

$4 US does seem to be the cheapest deal I've seen anywhere, but I guess it depends on exchange rate.

eBay's cheapest to me are $4.14 USD equivalent, but I find buying on eBay somewhat less hassle than AliExpress, so if the boards are of similar quality, I expect I'll stick with eBay :wink:

Roger,

The eBay 3 boards I received were all reworked- the uC had been reflowed and the flux left on the board. I have used all 3 however without any issues. My guess was that Baite was selling out the back door any boards not passing automated testing. All 10 boards from Baite were pristine but cost $24/5... Showing no rework. These latest 10 were $4 each and the 1 I pulled today for testing was prisinne.

I must be a glutton for punishment,

;D

Ray

Ray,

Ah OK.

One of my eBay boards has flux on one side of the uP and its obvious that one track doesnt have as much solder as the others.

I can't recall if I've plugged that board in (too busy as ever)

But I agree that the eBay boards could well be "seconds" / factor rejects.

Re: ESP8266

Its just finished uploading to my new version to github https://github.com/rogerclarkmelbourne/arduino-esp8266

Which seems to work fine, except you have to select "esp8266esptool" under the programmer menu
(This seems to be unnecessary, so I'm going to have a go at making it work like the STM32 where programmer selection inst necessary)

So if you have some free time, it would be good to know if this new version works for you

Thanks

Roger

Edit
BTW. With the ESP8266, I find the uploader a bit unreliable, and it doesnt tell you if its failed.

It seems to upload 2 files, the first one puts around 20 dots on the screen when it uploads
and with the second file, you should get dots all the way across the screen,

If the dots don't go all the way across, or it just doesnt seem to work, try resetting the board and uploading again

Edit 2

BTW. I just found out why I'd not noticed the github repo that Victor found (which I"ve now used!).

It was only released yesterday :wink:

I have a STM32F103 based industrial working board and I want to reprogram it.

This is my board:

It has:
P1 it's for a mini keyboard.
P2 - JTAG (20pins)
P3 - Prog/DBG_drive (6pins)
P4 - I2C1 socket (4 pins: GND, SDA, SCL, 3V3)
k8 - UARTS_CONN (3 PINS: RXD, TXD, GND)
P11 - Prog/DBG_HDD (6 pins)
and a final RFID_CONN (10 pins)

I understood from Home · rogerclarkmelbourne/Arduino_STM32 Wiki · GitHub link that Roger Clark managed to program some STM32F103 boards with the Arduino 1.6.x API.

Can I use the same API to reprogram my board?
Do I need some specific hardware to connect my board to my laptop? Can I connect the USART1 directly to my laptop?
Any suggestion or advice from you could help.

flax1k:
I have a STM32F103 based industrial working board and I want to reprogram it.
<...>
Can I use the same API to reprogram my board?
Do I need some specific hardware to connect my board to my laptop? Can I connect the USART1 directly to my laptop?
Any suggestion or advice from you could help.

As the board has JTAG, the answer is "yes" you could reprogram it. However, putting on the Maple bootloader will likely not help you achieve control over the board. As the board has many integrated peripherals already wired to the uC, you are not in control of re-routing SPI, I2C, and serial lines... these are hardwired to the chip.

You are welcome to go back into the 137 pages of this thread and I know a few folks have used JTAG, including Roger, but I really do not think that you will be able to salvage any useful functions from the board without a full schematic and possibly a listing of the current firmware in the uC so that a determination could be made by you to which ports are driving what devices on that board. Obviously, this would be a difficult effort and require advanced skills.

The Maple clone boards that started this thread about 6 months ago are in the $4 to $30 range from various mail order sources. I would strongly suggest that if you want to play with the STM32F1xx that you review this thread for those boards and sources. I can assure you that attempting to implement Arduino on your industrial board will be a most difficult task.

Regards,

Ray
My Projects

Hello,
my 4MB SPI flash memory chips (winbond W25Q64) arrived.
The only arduino library for that chips doesn't work/compile with/on the STM32_arduino, so I rewrote the whole structure into one test sketch before putting it into a library again.
I've done also a complete japanese/english translation (google translator japanese<> works very well!!) for all necessary notes
I'll wait until we get a complete DMA SPI interface library before I'll do further things with it.
Every function works as expected, highest SPI speed runs smooth out of the box (the chip is built for SPI speed beyond 100MHZ)
Here is the aliexpress link, where I bought them (about 30pcs because of shipping costs):
http://tinyurl.com/l2eu973
If anyone is interested, here is the test code:

regards
Matthias

winbond_template_working.zip (4.15 KB)

@flax1k If you are up for a lot of head scratching and probing with your multimeter, and if you have a specific task in mind for the board or if you have a pile of these boards you want to re-purpose, then I suspect it would be possible to reverse engineer the board and figure out which bits do what.

As Ray stated, this is not a trivial task. You would need to read through the STM32 datasheets to understand the processor architecture, and read this thread for some pointers to allow you to push firmware to the board.

Lots of high-res photos of both sides of the board would let you see which pins go where.

The design is likely to be loosely based on some of the STM32F103 reference designs, with perhaps a few GPIO pins dedicated to things like the relays (presuming those white rectangles on the right are relays).

If you just want to dabble with an STM32F103, get yourself a maple mini or clone and follow the examples in this thread.

If however you want the challenge of getting all of the parts of that controller board of yours to work, you are going to have to put a lot more effort in, but it looks like a fun challenge. Expect to take quite a few hours pouring over the STM32F103XXX datasheet and STM online documentation just to figure out which pins go where and therefore do what.

Take lots of notes as you go, reverse engineering leads you down a lot of strange rabbit holes, and if you don't keep notes you get lost pretty fast.

@madias - That opens up a bunch of interesting possibilities. The ability to page up to 8Mb of code and data from flash suggests it might be possible to run a real operating system on one of these boards. Busybox linux will boot off a couple of floppy disks for example... but maybe I'm getting a little bit ahead of my self :smiley: .

@mrburnette

mrburnette:
Thanks!

I have a different OLED with same resolution: 2-color mono display

I got my OLED working this morning using Software SPI. It's refusing to work using Hardware SPI, but I have no time today to dig into this issue... No issue with Hardware SPI and ILI9341 previously.

I also tried it on Nano328 and it worked using same pin numbers (unmod libs!):

 // software SPI works on Maple Mini ARM 32-bit

// use these settings for the OLED_Pro smart display...
  // These pin #'s are for Maple Mini/UNO/Nano/Mini328
  #define OLED_DC    6  // D/C
  #define OLED_RESET 5  // RST
  #define OLED_MOSI  4  // SDA
  #define OLED_CLK  3  // SCL
  #define OLED_CS    7  // Not Connected to OLED board
  Adafruit_SSD1306 OLED(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);





Ray
[OLED on the cheap...](http://www.hackster.io/rayburne/oled-on-the-cheap)

I've got that error in my arduinoIDE 1.6.1 when try to used your code
"
SPI_Test1.ino:11:30: fatal error: .\Adafruit_GFX.h: No such file or directory
compilation terminated."

do you know what's wrong?

@matthias

I started to look at putting DMA support in the SPI library last night.

However I came across a few issues with ISR callback not being possible to class methods in C++
So I had to code it with multiple static methods for the "DMA complete" callback and use switch statements in come places

However the code now compiles, and I will test it with the normal ILI9341 lib when it does the fill screen, as this should be a simple way to confirm it works

I'm adding SPIClass::DMATransfer(byte *buffer,int length) to the class, which takes pointer to the buffer to write and read into and size of buffer.
I will also do a version with a callback, or I may be able to just have one function which uses a default argument for the callback set to null. If no callback is specified, the code will be synchronous and Block / wait for completion in the function. But if a callback is specified, the transfer will be non-blocking and return immediately and also call the callback when the transfer is complete

I will not toggle the Chip Select pin in the function, as none of the other SPI functions do this. The main / calling code can handle CS :wink:

Ps. I'm not sure if I need a separate write and read buffer. It depends on how the DMA works. I need to double check if its necessary. It would be better if there was just one buffer I think, or perhaps I could get the function to accept 2 buffers, but they could be the same pointer.
Umm. Needs more thought and investigation :wink:

flax1k:
I have a STM32F103 based industrial working board and I want to reprogram it.

This is my board:
https://drive.google.com/open?id=0Byibq3E3WcsNSXN4SkdZRzVWbnc&authuser=0

It has:
P1 it's for a mini keyboard.
P2 - JTAG (20pins)
P3 - Prog/DBG_drive (6pins)
P4 - I2C1 socket (4 pins: GND, SDA, SCL, 3V3)
k8 - UARTS_CONN (3 PINS: RXD, TXD, GND)
P11 - Prog/DBG_HDD (6 pins)
and a final RFID_CONN (10 pins)

I understood from Home · rogerclarkmelbourne/Arduino_STM32 Wiki · GitHub link that Roger Clark managed to program some STM32F103 boards with the Arduino 1.6.x API.

Can I use the same API to reprogram my board?
Do I need some specific hardware to connect my board to my laptop? Can I connect the USART1 directly to my laptop?
Any suggestion or advice from you could help.

The resolution of the image on the google drive is not good, so its hard to read the silkscreen text.

However one USART connector appears to be labelled USART1 and next to it appears to be a switch to set the hardware boot lines.

So it may be possible to upload via serial, which is part of the repo.

However you will need to determine if our laptop has RS232 and also whether the USART connector is RS232 or 5v or possibly 3.3V serial.
Even if your laptop has a RS232 connector like the one on the board, you may need a Null Modem cable depending on how the USART connector is wired.

JTAG would probably work. But you'd need to buy a JTAG programmer module.
I have one, but have not managed to get it to work, and there is no support for JTAG in the repo - however it would be fairly easy to add something to call a third party JTAG CLI exe on windows.

If the board has STlink, Swd etc, the repo supports that, but you'd need to buy a STLInk adaptor.

Also, your board is a V series, we don't have a "variant" for that at the moment.

But for testing the "STM32 to flash" board type will work but it won't give you access to the extra SPI and UART etc etc that the high density boards have

I know that @bigjohnson was working on variants for V and Z series.

I added the R series the other day, but I think there are problems with it as some GPIO appears not to work

bigplik:
@mrburnette

I've got that error in my arduinoIDE 1.6.1 when try to used your code
"
SPI_Test1.ino:11:30: fatal error: .\Adafruit_GFX.h: No such file or directory
compilation terminated."

do you know what's wrong?

When you went here and downloaded my ZIP, it contained all the necessary libraries- modified for the Maple mini or 328'ish Arduino. You need to have everything in your sketch folder.

Ray

Guys

I have had some success and some problems with SPICLass:DMATransfer

I do have it working, however its via a hack

I'm not sure why this is happening, but if I declare

SPIClass
{
public
volatile static bool dma1_ch3_Active;

}

The cpp code is unable to access SPIClass::dma1_ch3_Active

i.e I get a compile error

I'm really not sure why I'm getting compile warnings with this

even if its non volatile e.g

SPIClass
{
public
static bool dma1_ch3_Active;

}

I still get the same compile warnings and the code crashes

So to get it working I've had to make it into a global variable

I guess I'll need to post another question to the programming forum, as I don't understand why the code can't do this :frowning:

e.g. This article seems to suggest it is possible

http://www.learncpp.com/cpp-tutorial/811-static-member-variables/

mrburnette:
When you went here and downloaded my ZIP, it contained all the necessary libraries- modified for the Maple mini or 328'ish Arduino. You need to have everything in your sketch folder.

Ray

@mrburnette
I put all that files from your zip package into one folder,
still not working and have same error