This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Issue with buttons_led_init when trying to program with HX711

Hello,

I am using a nRF52840-DK with an HX711 in SES. I have been utilizing the code provided by Vidar Berg that can be seen here

I downloaded the zip file, unzipped it, and then copied it into the ble_app_uart example folder, running the pca10056_s140 SES project file with the main.c, hx711.c, and hx711.h files from Vidar's code above. Everything complies correctly but I noticed the device wasn't advertising. Whenever I upload the code, LED5 begins flickering/flashing rapidly, and no other LEDs turn on. After some debugging I realized the program is prompting an error in buttons_led_init. The error is highlighted below in the main.c file.

Other people have gotten this code to work quite easily, and I trust that is correct considering Vidar wrote it. However after hours of debugging, changing memory, using DK boards, modifying files, and searching the devzone, I have found nothing that has worked. I am new to the nRF community so I feel like I may be making an obvious mistake. If anyone has any suggestions or tips, it would be much appreciated! Thanks in advance.

  • I adjusted them, but didn't realize button 4 used P0.25. That got rid of my initial error. Thank you. However, now I am receiving the following error:

    <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at C:\nRF52840-DK\nRF5_SDK_15.3.0_59ac345\examples\ble_peripheral\ble_app_uart_SDK\main.c:566
    PC at: 0x00029081

    What should my Macro memory values be? I thought they were correct at 

    FLASH_PH_START=0x0

    FLASH_PH_SIZE=0x100000

    RAM_PH_START=0x20000000

    RAM_PH_SIZE=0x40000

    FLASH_START=0x26000

    FLASH_SIZE=0xda000

    RAM_START=0x20002a98

    RAM_SIZE=0x3d568

    I have also tried modifying total links to 12, peripheral and central links to 6, and including the code linked here to ble_stack_init() to attempt to increase the attribute table size. Nothing has worked yet. Any ideas?

  • Hi,

    Which function returns NRF_ERROR_NO_MEM? (It seems you have made some modifications to Vidars example, so the line number (566) does not match with the code I have).

    JWCode said:
    What should my Macro memory values be? I thought they were correct at 

    Some of it depends. In short:

    • FLASH_START: should be the same as the size of the SoftDevice (you can either check in an example project using the same SoftDevice or the SoftDevice specification).
    • FLASH_SIZE: Usually not that important unless you are using a lot of flash, but strictly speaking it should be set to the total flash size - FLASH_START - any-other-flash-usage-such-as-fds.
    • RAM_START: It depends on the SoftDevice configuration. If you have changed the SoftDevice configuration (such as the number of peripheral or central links or attribute table size), this will increase. It is difficult to calculate, which is why the SoftDevice will tell you how to adjust it. See Adjustment of RAM and Flash memory for details.
    • RAM_SIZE: Physical RAM size - RAM_START.
    • The other parameters (*_PH_*) are supposed to represent the physical memory of the device, but it is not used for anything so it can be ignored.
    JWCode said:
    I have also tried modifying total links to 12, peripheral and central links to 6, and including the code linked here to ble_stack_init() to attempt to increase the attribute table size. Nothing has worked yet. Any ideas?

    Why did you adjust the link counts? Using multiple links is no problem, but it is a good idea to get one thing working before moving on to the next.

  • The same function I mentioned earlier(buttons_leds_init) returns the no memory error. It seems the adjustment of pins just changed the error code from error 8 to error 4. Specifically, the following two lines:

    uint32_t err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS, bsp_event_handler);
    APP_ERROR_CHECK(err_code);

    Thanks for the thorough description of the Macros, that clears it up. I have changed the link counts back, I had just seen it suggested as a possible solution for the error code I have been receiving, but am still receiving the NO_MEM error.

  • Hi,

    One possible explanation is that you have queued too many timer operations. Does it help to increase APP_TIMER_CONFIG_OP_QUEUE_SIZE? If not, have you tried to step into bsp_init() and see where the error comes from? the further in you go, the closes you will come. Probably you will just need to step down a few functions before you find the reason.

  • Unfortunately, that did not work. When I tried stepping through bsp_init(), I made it through the entire function. However, once it kicked back out into main, the function went to ASM volatile in app_error_handler. I am not quite sure where the error is coming within bsp_init as I do not fully understand what should be happening within the function. Are there any typical red flags or error functions I should be keeping an eye out for?

Related