News:

Let's find out together what makes a PIC Tick!

Main Menu

18F25k22 versus 18F2550

Started by Yves, Aug 28, 2022, 02:36 PM

Previous topic - Next topic

Yves

Hello all,
I have a relatively large code that just fit the 18F25k22 chip. I wanted to transpose the same code into the 18F2550 chip but on compiling I get a message saying there is not enough RAM. When I check the specification both chips have the same amount of flash and other memories but only the 18F2550 has 2048 SRAM instead of 1536 for the 18F25K22. Please note that I have change the fuses for each chips.
I don't understand why the 18F2550 give me a not enough RAM warning? Any Idea?

Regards,

Yves
Yves

top204

The PIC18F2550 device contains a USB peripheral, so most of its RAM is dedicated for that and the compiler removes the USB RAM from standard use.

To use all of the RAM for general purpose, and not use the USB peripheral. Tell the compiler that the device "does not" contain a USB peripheral by:

Declare Onboard_USB = 0

And it will give access to the 2048 bytes of RAM.



Yves

Thank you Les,

Well I will have to figure out how I can shrink my code as I was hopping yo use the USB functions. I have a lot of variable which are dim as floats I could try to do more integer math. Any Idea how much space the USB automatically takes? Another alternative will be to add an adaptor to covert my data to USB output.

Best regards,

Yves   
Yves

trastikata

#3
Quote from: Yves on Aug 28, 2022, 07:12 PMWell I will have to figure out how I can shrink my code as I was hopping yo use the USB functions. I have a lot of variable which are dim as floats I could try to do more integer math....

You can repurpose some of the USB variables in code where no USB routines are used. You can repurpose arrays too if you don't need them all the tame, for convenience simply declare the variables aliased to the array member. Some examples:

Dim BigArray[128] As Byte
Dim MyString As String * 85 At BigArray#0
Dim MySmallArray[10] As Byte At BigArray#85
Dim MyFloat As Float At BigArray#94

But the 2550 has plenty RAM, unless you are using large arrays, it should be more than sufficient.




top204

#4
For some inexpicable reason, Microchip implemented the double buffered USB RAM, smack bang in the middle of normal RAM! So the RAM becomes fragmented because the USB must use the dedicated RAM area for its buffers and headers etc...

There is RAM above the USB buffer that can be used, but it will need to be addressed RAM based upon the size of the buffers and endpoints used for the USB coms?

Personally, I gave up on the Microchip USB tranceivers many years ago because they are just a mess, and never made real sense for thier operations and RAM placements etc... They are also quite unreliable. 

towlerg

Silly question but if you wish to retain USB function, isn't 18F2550 port to 18F25K50 a natural fit?

Yves

@Towlwerg
Yes absolutely I will like to use USB 18F2550 on my project. Do you have a way around it?

Yves
Yves