Jump to content
  • 0

Error Compiling Chipkit WF32


Stargo_44

Question

Hello,

When I try to compil a code on my Chipkit WF 32 I got a failed compiling but not on my arduino mega...

On the IDE I change the board when I compile for the arduino or digilent board. I tryed the arduino IDE and UECIDE and I get the same result, failed on the Chipkit. 

I've reduce the code to show you exactly where the error come from, that's come from the convertion of the char array to unsigned integer. I don't know what's happening. If some one have an idea :)

Thanks

CODE :

void setup()
{
}

void loop()
{
}

int Motor_2(unsigned char numInputBytes, unsigned char* input, unsigned char* numResponseBytes, unsigned char* response)
{
//Convertion of the char Array input to unsigned interger (Step to move)
unsigned int Step_To_Move_2 = atoi(input);
}

Error Message :

Arduino : 1.8.14 Hourly Build 2021/05/11 02:33 (Windows 10), Carte : "chipKIT WF32, Custom / Disabled"

C:\Users\pgrol\Desktop\temporaire\temporaire.ino: In function 'int Motor_2(unsigned char, unsigned char*, unsigned char*, unsigned char*)':
temporaire:12:41: error: invalid conversion from 'unsigned char*' to 'const char*' [-fpermissive]
 unsigned int Step_To_Move_2 = atoi(input);
                                         ^
In file included from C:\Users\pgrol\AppData\Local\Arduino15\packages\chipKIT\hardware\pic32\2.1.0\cores\pic32/WProgram.h:8:0,
                 from C:\Users\pgrol\AppData\Local\Arduino15\packages\chipKIT\hardware\pic32\2.1.0\cores\pic32/Arduino.h:4,
                 from sketch\temporaire.ino.cpp:1:
C:\Users\pgrol\AppData\Local\Arduino15\packages\chipKIT\hardware\pic32\2.1.0\cores\pic32/stdlib_noniso.h:34:5: error:   initializing argument 1 of 'int atoi(const char*)' [-fpermissive]
 int atoi(const char *s);
     ^
exit status 255
invalid conversion from 'unsigned char*' to 'const char*' [-fpermissive]


 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi @Stargo_44,

Digilent doesn't have direct experience with the ChipKIT Core, so I'm not able to comment on it directly, but I was also able to confirm that I got a very similar error to what you received while using the Digilent Core. I'm seeing some similar threads about this error on various pages: link1, link2, link3, link4.

Thanks,
JColvin

Link to comment
Share on other sites

  • 0

With the command below it works well (thanks to sterretje in arduino forum).

 unsigned int Step_To_Move_2 = atoi((char*)input);

 

But now I've notice something weird.

In my project I use WS2812 Leds. Everithing works well when I use the firmware from "LINX Firmware Wizard" in LabVIEW (compilation from labview and not the arduino IDE)

I need to add a custom command in this firmware. So I opened the firmware in the arduino IDE. First things I noted, I didn't have the ws2812.h library. I found this library here "LabVIEW 2020\vi.lib\MakerHub\LINX\Firmware\Source\core\libs\WS2812", so I added this library in my arduino library.

Then compiled the code to the WF32, but now when I try to control the Leds I got a message error from the WS2812 Open.vi.

Error 5009 : Unable To allocate memory for WS2812 Open command.

I'm almost sure this error come from library I added to the arduino library. But I don't know why ?

And the custom command works well, but when I try to control the leds i got this errors. (I try without the custom command in the firmware and I have the same issue).

Link to comment
Share on other sites

  • 0

Hi @Stargo_44,

How many WS2812 LEDs are you attempting to control in addition to other applications that you might have going on within the project? You could try allocating some more memory to the WF32 within the Arudino IDE by using some code like in this post: https://forum.digilentinc.com/topic/21613-digilent-wifire-pic32mz-running-out-of-ram-before-512-kb-are-allocated/?do=findComment&comment=62429. I'm not able to readily find any returned error codes matching the "unable to allocate memory for the WS2812 Open Command". The closest I can find is the Ws2812Open function within the LinxChipkit.cpp (found in a couple of places, I'm looking at .\LabVIEW 2020\vi.lib\MakerHub\LINX\Firmware\Source\core\device\utility) that checks to see if either buffer was not successfully allocated via malloc, returning 0x81, but I can't find any details on what 0x81 corresponds to.

I'm not certain what/where the root issue is, though it is probably worth noting that NI has a dedicated section of their forum for LINX material, https://forums.ni.com/t5/Hobbyist-Toolkit/bd-p/linx-toolkit?profile.language=en, though now that I linked it I can see you have already made a post there.

Thanks,
JColvin

Link to comment
Share on other sites

  • 0

I control 29 Leds. But as I said with the firmware compiled from "LINX Firmware Wizard" in LabVIEW, there is no issue.

When I compile the firmware (without custom command) with the arduino IDE, I have the error code when I want to control the leds.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...