2017-01-06 03:15 AM
Hello,
I am using a custom board with a STM32F107VC processor. I am trying to get LWIP working in combination with FREERTOS. I am building using STM32Cube and importing into STM32 System Workbench,
I can see DHCP packets being sent from my controller, arriving on the network (seen via wireshark). My DHCP server responds, but the micro controller does not seem to be able to process the message correctly.
I can see that the tcpip_input thread is being called because I can put a breakpoint into it. This then progress into sys_mbox_trypost() which seems to be failing with a -1 ERR_MEM which has a note above it 'could not post, queue must be full'
Does anyone have any idea what the issue may be?
Thank you
Daniel
Solved! Go to Solution.
2017-01-06 04:43 PM
Actually the issue was that the main LWIP tcpip thread was not starting with and errored -1 out of memory message. Therefore the mailbox was not processed and after several incoming packets was full.
Fixed by increasing heap in linker as follows:
_Min_Heap_Size = 0x2000; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */Why STM32Cube isn't doing this... who knows
Now I get DHCP. Ping and can open TCP server socket
Daniel
2017-01-06 01:55 PM
It's clear that you don't have enaugh space in the queue.
Check that you have defined in lwipopts.h :
TCPIP_MBOX_SIZE
DEFAULT_UDP_RECVMBOX_SIZEDEFAULT_TCP_RECVMBOX_SIZEDEFAULT_ACCEPTMBOX_SIZEwith enaugh size.
eg :
#define TCPIP_MBOX_SIZE 64
#define DEFAULT_UDP_RECVMBOX_SIZE64
#define DEFAULT_TCP_RECVMBOX_SIZE64
#define DEFAULT_ACCEPTMBOX_SIZE64
if they are present and the size is high, check the sys_mbox_t sys_mbox_new(int size) function declaration. If you are not using the size argument that means that you are not using those defines. if so, call xQueueCreate using size.
2017-01-06 04:43 PM
Actually the issue was that the main LWIP tcpip thread was not starting with and errored -1 out of memory message. Therefore the mailbox was not processed and after several incoming packets was full.
Fixed by increasing heap in linker as follows:
_Min_Heap_Size = 0x2000; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */Why STM32Cube isn't doing this... who knows
Now I get DHCP. Ping and can open TCP server socket
Daniel