• Welcome to Andy's Workshop Forums. Please login or sign up.
 
May 02, 2024, 09:51:32 pm

News:

SMF - Just Installed!


Mixing RMII Ethernet and GpioA

Started by ris2t, May 30, 2015, 06:10:36 pm

Previous topic - Next topic

ris2t

Hi

Novice question I'm hoping for some guidance on. Using STM32F4 Discovery board.

I've taken the stm32plus-examples-net-web-client (RMII) project and extended it to read a DHT11 (humidity and temp sensor) on pin PA03.

Within the DHT11 code I'm using the GPIO template to initialize the pins.
    GpioA<DigitalOutputFeature<GPIO_Speed_50MHz,Gpio::PUSH_PULL,Gpio::PUPD_NONE,GPIO_PORT_NUMBER> > pa_out;

GpioA<DigitalInputFeature<GPIO_Speed_50MHz,Gpio::PUPD_NONE,GPIO_PORT_NUMBER> > pa_in;

In isolation the two pieces of code work fine, I can do Ethernet and separately DHT11 reading.

However when joined in various orders ethernet and DHT11 readings fail. I get the impression the port isn't setup any more.

Question:

Is it possible to declare multiple instance of the GpioA template on the same port group, or should I be using something like GpioPinInitialiser::initialise.

Look for any guidance on why declaring GpioA would clash with the ethernet classes.

Thanks
Raymond


ris2t

Upon further investigations:

GPIOA-<MODER register seems to been set correctly and overlap, so this suggests using the GpioA template is complementary (i.e. no conflict).

This code seem to hang having gone into startup.asm on "Infinite_Lopp".  Likely I have some kind of memory allocation issues, so will investigate that angle.


Thread [1] (Suspended : Signal : SIGINT:Interrupt)
WWDG_IRQHandler() at Startup.asm:113 0x8005dac
<signal handler called>() at 0xfffffff9
_malloc_r() at 0x801d4ba
stm32plus::net::NetBuffer::NetBuffer() at NetBuffer.h:79 0x8007236
stm32plus::net::TcpConnectionState::sendHeaderOnly() at TcpConnectionState.h:113 0x800962e
stm32plus::net::TcpConnectionState::sendAck() at TcpConnectionState.h:69 0x8009574
stm32plus::net::TcpConnection::receive() at TcpConnection.cpp:808 0x8001e22
stm32plus::net::TcpTextLineReceiver::add() at TcpTextLineReceiver.h:91 0x8009aa8
stm32plus::net::HttpClient::readResponse() at HttpClient.h:282 0x800a8f0
stm32plus::net::HttpClient::sendRequest() at HttpClient.h:220 0x800a728
<...more frames...>


Thanks

Andy Brown

Hi Raymond. Yes it's safe to have multiple Gpio declarations. You can have them anywhere in your code and the pin configuration will persist even after the Gpio object has gone out of scope.

Although PA3 is required for MII it should be free when using RMII so you don't have an obvious pin clash. The stack trace does look line a memory issue. Are you trying to process more data than you can fit in SRAM?
It's worse than that, it's physics Jim!

ris2t

Thanks for the confirmation.

Eventually trace my problem of passing a char array to httpClient.setUri rather than a C++ string. Issues fixed.
char datapump[160];
httpClient.setUri(datapump);

instead off
std::string datapump;
httpClient.setUri(datapump);