Go Down

Topic: STM32, Maple and Maple mini port to IDE 1.5.x (Read 643079 times) previous topic - next topic

rogerClark

Guys,

As indicated in a previous post... Following on from a report of issues compiling some libraries due to non standard functions in libmaple...

I've removed the following functions

togglePin()
toggleLED()
isButtonPressed()
and
waitForButtonPress()


I've updated all the examples that use any of these (toggleLED is used a lot !)

tooglePin was also used internally for shiftOut as well as in the examples, so I have updated the necessary internal files as well


Note. One example, interactiveTest.ino uses a another internal function gpio_toggle_bit() to demonstrate fast GPIO, so in this example, I have used gpio_toggle_bit() to everywhere that it used togglePin

Elsewhere, I think I've managed to replace the function calls with high level / standard Arduino API calls, like digitalRead and digitalWrite.

I've test compiled all the examples, and uploaded any that seemed testable, to my Maple board, and as far as I can tell they all compile OK, and where I could test them, they also run OK.

I also test compiled one or two for a non-maple board and they was also OK.

If anyone has any issues with this change, please let me know

Cheers

Roger
Freelance developer and IT consultant
www.rogerclark.net

rogerClark

Guys,

Just a note, in case anyone is searching the forum for this information...

I find with my Maple (non mini) board, that after upload, the USB bus isn't enumerated.

If I press the reset button, after the upload has completed, the board enters its DFU mode for a short time, and then re-enumerates and the serial device (in my case COM41) appears.

The strange thing, is that after the upload, the board does appear to start running the code, but its not forcing the bus re-enumeration at that time.

Its not a big deal for me, as I just press the reset button after upload, but I'm sure some people will have the same issue and perhaps not know the work around



Cheers

Roger

PS. I guess I should really investigate what bootloader is installed on the board, because the Maple (non mini) uses a different bootloader as from what I recall the LED pin and the button may not be on the same GPIO pins as on the Maple Mini - but apart from that I thought the bootloader was supposed to be the same

Freelance developer and IT consultant
www.rogerclark.net

ahull

#2162
Apr 07, 2015, 01:47 pm Last Edit: Apr 07, 2015, 04:59 pm by ahull
@ahull

...
Can you see if it still works for you?

It all looks fine.

I also tidied up the wiki article.

EDIT: I took another quick look at trying to reset the STM32 USB device from software, but the problem is that I need to cut the USB power and there seems to be no reliable programatic method to do this. Although a lot of USB chipsets include this feature, most hardware vendors don't include the necessary circuitry to actually implement it.

I think we are stuck with physical reset. i.e. Physically cut the USB power and reconnect , for non Maple boards.

I tried toggling DTR and echoing "1eaf" to the device, but it just ignored me. Even pressing the reset button on the STM32 board doesn't make a difference, only powering the board off and back on lets Linux know it has changed state.

Perhaps I might take another look if I get the time, but to be honest it would be quicker to wire up a make/break switch on the +5V line in a USB extension lead to do the same thing if damaging your USB ports is a concern.

Just make something like one of these and (assuming you have used 4 core wire), wire the data lines through... or build you own solution from whatever you have to hand.

Alternatively, one of these or if you have lots of devices to program, one of these, but you would need to externally power it, will do the trick.

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.
   
Mustafa

madias

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 :/

rogerClark

#2165
Apr 07, 2015, 11:48 pm Last Edit: Apr 07, 2015, 11:48 pm by rogerClark
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.
Freelance developer and IT consultant
www.rogerclark.net

rogerClark

@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
Freelance developer and IT consultant
www.rogerclark.net

madias

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.

rogerClark

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 )
Freelance developer and IT consultant
www.rogerclark.net

turkogluky

@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
Mustafa

rogerClark

@turkogluky


Quote
What is the correct pin ?
It uses GPIO so any pin should work

Quote
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 ?
Freelance developer and IT consultant
www.rogerclark.net

mrburnette

@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


victor_pv

@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.

rogerClark

Victor

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

Thanks

Roger
Freelance developer and IT consultant
www.rogerclark.net

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) ;-)

Freelance developer and IT consultant
www.rogerclark.net

Go Up