Does the RF24 library (from TMRh20) work on STM32F103?

Can someone help me port this library?
zmemw16
Posts: 1680
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by zmemw16 » Wed Jan 27, 2016 10:34 pm

its either gotcha or any progress?

smiley supplied is just not big enough

stephen

User avatar
RogerClark
Posts: 7683
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by RogerClark » Wed Jan 27, 2016 10:43 pm

Hi Martin

Unfortunately, I can't even remember starting it ;-)

Well, actually a vague recall looking at this.

I think I had some issue redirecting the output of printf putc into the USB Serial.

It was probably a case of running out of time and having more pressing things I needed to do

If I get time (A big if), I will take a look at what the ESP8266 does and possibly be able to learn from that (albeit they are sending chars to the hardware via the SDK, not to the virtual serial buffer, but surely it must be very similar !)

User avatar
martinayotte
Posts: 1241
Joined: Mon Apr 27, 2015 1:45 pm

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by martinayotte » Wed Jan 27, 2016 11:35 pm

Hi Roger,
I've actually looked at ESP version of printf, and then look at STM32 to get the actual discovery of the job was started.
It is a bit similar, but as you said, we need to figure out possible impact, and if none, then enabling that code by default.

On ESP, here how it looks (see that it is limited by MTU size 1460) :

Code: Select all

size_t Print::printf(const char *format, ...) {
  va_list arg;
  va_start(arg, format);
  char temp[1460];
  size_t len = ets_vsnprintf(temp, 1460, format, arg);
  len = print(temp);
  va_end(arg);
  return len;
}

User avatar
RogerClark
Posts: 7683
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by RogerClark » Thu Jan 28, 2016 1:58 am

Hi Martin

Umm.

OK. That looks like a bit of a bodge.

I will need to see what

ets_vsnprintf() does


I'm sure I've read something about somehow redirecting the PutC output from vaprintf etc, so that it goes to whichever function you want

But I think that's as far as I got.

Edit.

It looks like we'd need to define put_ch()

e.g. I think this link has some information

http://www.electro-tech-online.com/thre ... ne.135005/

madias
Posts: 813
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by madias » Thu Mar 10, 2016 8:55 pm

Ok, I stumbled also across the TMh20 RF24 library (it's the most recent NRF24 library and very convenient in contrast to other ones).
I think a possibility is to look again to the genius Paul Stoffregen and his teensy project and how he solved the "printf" "feature":
https://github.com/PaulStoffregen/cores ... /Print.cpp

Maybe I have some time to play with that...

>EDIT< Ok, it seems, like Roger did already take the teensy part for printf. Ok, didn't got the library working (totally no response, but compiling is ok, how I hate that...). So at first, I'm going to check out the other nrf24 library (enrf or something from energia) to be sure, that the module is working well.
Last edited by madias on Thu Mar 10, 2016 9:20 pm, edited 1 time in total.

User avatar
RogerClark
Posts: 7683
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by RogerClark » Thu Mar 10, 2016 9:04 pm

Thanks Matthias

It looks like Paul is calling vdprintf, which he is passing a pointer to the Print class, so that vdprintf would treat the Print class as some sort of File stream (But i may be wrong about how it works)

I presume vdfpintf calls the write function (again I'm not sure)

But it would definitely be worth investigating

madias
Posts: 813
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by madias » Thu Mar 10, 2016 9:25 pm

Roger, I edited my comment... looking further getting the device running.

Little offtopic:
A really MUST have little helper for the nrf24 modules (only 60 Cent (Euros)):
http://www.aliexpress.com/item/New-Sock ... 27557.html
With this little guys (ok, ok can solder it easily by yourself, but for 60 cents...) all my problems with the modules are history (remember, that I'm working on many different MCU devices, so I cannot remember all max mA for 3.3V, I'm lazy and I'm a fan of voltage converters for every different module)).

User avatar
RogerClark
Posts: 7683
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by RogerClark » Thu Mar 10, 2016 9:58 pm

Hi Matthias

I remember looking at it, over a year ago, but I can't remember why it wasn't working

I think possibly its something to do with some functions like putc() , or possibly its called putch() not being implemented
Or if they are implemented they don't do whats required.

I don't think I could work out how to setup the linkage to these character writing functions.

I'm sure its documented somewhere on the web e.g.

http://stackoverflow.com/questions/1827 ... internally

madias
Posts: 813
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by madias » Thu Mar 10, 2016 11:06 pm

Ok, small status update: didn't got the NRF24`s running even with enrf24 correctly (breaks, crashes...). Tried many things like external power. I think enrf24 isn't really stable (got the blue fading led sometimes). So my question is: Has someone out here got the NRF24's running stable? And if "yes" with which library? (Until I know that the devices won't work probably, I see no sense digging into the TMRh20 library. cause I need a stable hardware setup at least)
small edit: The enrf24 scanner demo looks like working fine, but the rx/tx demo doesn't. Won't get any connection between two minis. (I think the RX demo code is the problem, hangs up)

jbforrer
Posts: 18
Joined: Thu Oct 08, 2015 5:44 am

Re: Does the RF24 library (from TMRh20) work on STM32F103?

Post by jbforrer » Fri Mar 11, 2016 5:42 pm

@madias --- I had good luck with the TMRh20 library (with few changes) using a Blue Pill module.
Attached a working example as used with my home sensor network.
Hope it helps.

Regards.
-JBF.
Attachments
STM32-nRF24L01_Sensor_RX.zip
(33.86 KiB) Downloaded 259 times

Post Reply