0

Problem running build from master
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Problem running build from master

by superjudge on Thu Dec 01, 2016 12:40 pm

Hi!

I've started playing with MicroPython for my Feather M0:s, and I started looking into adding support for the different types of radio chips (starting with the RFM69). As part of that process, I thought it a good idea to get my own builds from the master branch working, before I start adding stuff. However, I'm having a bit of problem getting stuff running!

I've followed the instruction in the README. I am running Linux (Ubuntu 16.04.1), and I am using the latest arm-none-eabi toolchain from https://launchpad.net/gcc-arm-embedded (currently version 5.4.1), and the build actually goes through cleanly. I am also able to flash the new binary image, but here things become flaky. When I reset the chip, sometimes it mounts the flash and I am able to get into the interpreter, but most of the time, the chip seems dead and unresponsive.

Is there a known state on the current master? And is there anywhere else the development is being discussed, or is this the right place to be?

I'll continue to play around and familiarize myself with things, but any pointers or input is welcome!

Oh, and thanks, both for the very cool Feather boards, and for your efforts on getting MicroPython running on them!


Cheers,

/johan

superjudge
 
Posts: 14
Joined: Sat Nov 26, 2016 12:02 pm

Re: Problem running build from master

by visualecho on Fri Dec 02, 2016 9:43 pm

So you're using the M0 here with the Lora radio (like Adafruit #3178)? Sounds good, but I didn't think it had enough flash on board. MicroPython needs 1MB and the M0 has 256K? or I'm missing something?

My grandpa would say "ya can't put 40lbs of fertilizer in a 10lb bag", but hope I'm wrong about this.

visualecho
 
Posts: 5
Joined: Thu Apr 16, 2015 6:39 pm

Re: Problem running build from master

by superjudge on Sat Dec 03, 2016 3:27 am

I am actually using the Feather M0 RFM69HCW (https://www.adafruit.com/products/3176), not the LoRa one, but AFAICT they are identical except for the radio core. It is possible to run MicroPython on it, I've installed the official beta from Adafruit, and it runs beautifully, and the version I build myself runs sometimes, but flaky.

The Feather M0 has 32K RAM and 256K flash. I've also seen numbers like you mention, but I'm very new to MicroPython, so I have not really grokked the whole history yet. I don't know if Adafruit did things to decrease memory requirements in their port, or if MicroPython itself became slimmer? Note also that the Adafruit MicroPython port also sets aside about 47K flash for a file system (I seem to remember reading somewhere that it should actually be 64K, but I may be wrong, and the actual size reported by Linux is 47K), so there is even less flash left for MicroPython itself.

Anyway, my problem is not that MicroPython does not run at all, but that my own builds are unstable, sometimes they work, sometimes they don't. I guess this can be an effect of the whole thing being in beta, maybe the master branch does not always run cleanly? I'll continue to dig around and try stuff!


Cheers,

/johan

superjudge
 
Posts: 14
Joined: Sat Nov 26, 2016 12:02 pm

Re: Problem running build from master

by visualecho on Sat Dec 03, 2016 12:36 pm

Good info, thank you, very interesting. Yes, the two only differ significantly in the specific radio (and a few balun components for the frequency). It's been my experience that where there's 'flakiness' (excellent engineering term) it's from some weird compiler flag getting set/unset, something to do with multi-threading (not likely in this scenario), something to do with cross compiler addressing or endianess (also doesn't seem likely), or a physical thing (matter, energy, and pass the mashed speed of light squared, please). Since you're reporting some success... wow, not sure what to think other than... cool! I have to try this now!

Okay, hadn't seen this either... Mr. DiCola's article at https://learn.adafruit.com/micropython-for-samd21 is new to me (about 2 weeks old as I write this), and this confirms what you're saying... it works. I got work to do.

----------------------- edit a few hours later

Yep, this works for me. I tried the latest master, it compiles but there are no modules (obviously in a transitory state). Flashing the 1.8.5 binary firmware bin worked pretty well, but notably absent are the PA06, PA08, and PA09 pins. Downloading the source code for the 1.8.5 firmware bin, I was able to create a new board by copying boards/feather_m0_basic to boards/feather_m0_radio and add the pins. That worked except that I noticed:
Code: Select all | TOGGLE FULL SIZE
soft reboot
Adafruit MicroPython v1.8.5 on 2016-12-03; Adafruit Feather M0 Radio with samd21g18
>>> from machine import Pin
>>> pin = Pin('PA17', Pin.OUT)
>>> pin.value()
0
>>> pin.value(0)  <-- LED goes off
>>> pin.value()
0
>>> pin.value(1)  <-- LED goes on
>>> pin.value()
0

that Pin.value() doesn't appear to return the last state correctly. I'm of the opinion that I need to start reading the datasheet on the LoRa module, as it appears that there may be only minor difficulties getting that to work very soon. Time.tick_ms() will tell.

visualecho
 
Posts: 5
Joined: Thu Apr 16, 2015 6:39 pm

Re: Problem running build from master

by tannewt on Fri Dec 09, 2016 12:37 am

superjudge and visualecho,
You both are brave building from master! I'm the main dev and think things should be relatively stable. Please file a github issue if (or more likely when) you experience any weirdness with master. I'll get an email that way and try to fix things quickly. :-)

I think the 47K reported by the filesystem is due to the FAT filesystem overhead but I could be wrong. The full space it has is 64k unformatted.

We can fit in the limited flash and RAM by offering a limited number of built-in modules. We aren't the smallest though, the microbit also runs micropython with 16k RAM. I started with the minimum port and add things as we need them. So, if you find something missing let me know via a GitHub issue (for example I just enabled enumerate()).

visualecho, since you've experienced upstream MicroPython beware that the SAMD21 port doesn't support machine in master. We're moving to a different hardware API (nativeio, microcontroller and board) designed as a cross-port foundation for device drivers. Currently, its also available on the Adafruit MicroPython ESP8266 port as well. (machine is still there too.) Docs are available here and feedback is welcome: https://adafruit-micropython.readthedocs.io/en/latest/

tannewt
 
Posts: 2496
Joined: Thu Oct 06, 2016 8:48 pm

Re: Problem running build from master

by superjudge on Fri Dec 09, 2016 3:59 am

Ha, ha, yeah, I like living on the edge!

But seriously, thanks for your answer! I have not tried building master in a few days, but I'll get back to it this weekend, and see if I can get it to work!

At the moment, I am mostly interested in getting support for RFM69. I started looking at getting one of the RFM69 stacks into MicroPython, hence my interest in being able to build from master. I also started looking at doing a native Python implementation, but as I understand it, SPI support is not fully there yet? A native Python implementation would probably not be the most efficient thing, but it's a fun exercise to learn the radio functions.

Anyway, I'll move feature requests and discussions around specific features to Github (I am "superjudge" on Github as well, so if you start seeing stuff from that user, it's me).

Thanks a lot for your work on MicroPython for the Feather boards, it's a really nifty combo! Keep up the good work!

EDIT: I couldn't stop myself, I just had to try a build again, and now it actually seems to work without any of the problems I saw before! Excellent! What is the status of the SPI implementation in master (preferably the native one for Feather), should it be working, or is it still WIP? I'll play around and try it anyway, just wanted to hear where you think it's at.


Cheers,

/johan

superjudge
 
Posts: 14
Joined: Sat Nov 26, 2016 12:02 pm

Re: Problem running build from master

by tannewt on Fri Dec 09, 2016 2:18 pm

The SPI should be working now. I was testing it last Friday with the ILI9341 last week. I did add transaction locking so you may want to read this to get an idea of how to use it. The SPIDevice class is really helpful if its kinda "normal" SPI. I've never done anything with the RFM69 so I can't give specifics.

tannewt
 
Posts: 2496
Joined: Thu Oct 06, 2016 8:48 pm

Re: Problem running build from master

by superjudge on Fri Dec 09, 2016 2:30 pm

Excellent, thanks! I think I will start with trying to do a pretty straight port of https://github.com/LowPowerLab/RFM69 into pure Python (using the SPI-code you point to), and see where I end up.

Performance (and maintenance) wise, it's probably better to go with C/C++ and wrapping the LowPowerLab library, but I'm also interested in learning about the radio stuff, so doing a port to pure Python should provide some interesting knowledge.

I will keep you posted!


Cheers,

/johan

superjudge
 
Posts: 14
Joined: Sat Nov 26, 2016 12:02 pm

Re: Problem running build from master

by tannewt on Fri Dec 09, 2016 2:40 pm

Awesome! Let me know what bugs you find!

tannewt
 
Posts: 2496
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.