Lpc54606 crate not available


I am looking for the NXP lpc54606 crate. I did not find it and hence believe I might need to create it.

Before starting this task, I believe I could take an existing one and adapt it to this chip. My question is : does anyone have started this task already? If not which crate should I take to start the lpc54606 one, find the most similar one to adapt the code?

I'm not familiar with the LPC54606, so I don't know which other chips are most similar, but here are some pointers to other LPC-related crates that might serve as inspiration:

Hope this helps!

@hannobraun: Thank you for your answer. I am new to embedded programming, and you seem to be quite advanced. So to establish if the job is not too complicated for me, I would like to ask you a couple of question if you have time.

First I am expecting the job to be essentially adapting an existing crate to match the memory assignment of the chip (that I would find in the doc of the chip). But the crate lpc55-pac seems very dense and much more complicated than I expected. So do you think that taking this crate, adapting the memory addresses would be a reasonable first step?

I do not need to use the full range of possibilities of the chip, for now. My context is that I need a clock (SysTick for example), a SPI connection, and a couple of more stuff that I still have to understand. So would my issue be actualy much simpler than trying to adapt the lpc55 crate?

You absolutely do not need to adapt an existing PAC, nor should you!

Some background:

  • A PAC (Peripheral Access Crate) basically provides raw access to the hardware. It allows you to use the hardware to its full extent, but will not prevent you from making mistakes. Every PAC is automatically generated from an SVD file. SVD files are provided by the chip vendor, and describe the all peripherals.
  • A HAL (Hardware Abstraction Layer) is a hand-written library that is built on top of the PAC. There is a lot of variation among HALs, but in general, a HAL will attempt to provide a safe API that prevents you from making mistakes, for example by forcing you to initialize a peripheral before allowing you to use it.

Since your chip doesn't seem to have any Rust support at all, as far as I can tell, you first step is to find yourself an SVD file and generate the PAC:

  1. For NXP, SVD files can usually be acquired through the MCUXpresso SDK Builder. For some reason that site seems to have gotten harder to use since I last tried, but your goal is to generate yourself an SDK for the LPC54606 (probably the MCUXpresso one, maybe others will work too) and download it.
  2. Most of the SDK will be useless to you, but the SVD file should be in there somewhere. Its name will probably be LPC54606.svd or LPC54606.xml.
  3. Once you have the SVD, you can use svd2rust to generate your own PAC crate. This step can be a bit problematic, as the general quality of SVD files usually ranges somewhere between bad and horrific. You might need to make some changes (like renaming identifiers to prevent duplicate names) before it can generate the PAC.

Those steps should be manageable for a beginner, but if you have any problems, feel free to ask here again.

All of this should give you a mostly complete, possibly somewhat buggy, PAC. I encourage you to publish it, on your own or by submitting it to lpc-pac and joining the lpc-rs group, as you prefer.

Once you have the PAC, you have basically two options:

  1. Use it directly in your application.
  2. Write a HAL first, then use that in your application.

Using the PAC directly will be tedious and error-prone, but so is writing a HAL. In both cases, you will need to become familiar with your chip's user manual (at least the parts that are relevant to you), as a PAC is generally impossible to understand on its own. It will make sense, if you're familiar with the user manual though.

I also recommend looking at existing HALs, as inspiration for your own, or at least as a guide on how to use the PAC. I can recommend lpc8xx-hal, as that has seen a lot of work recently and is pretty decent, but I don't know how similar LPC800 is to LPC54000.

One last note: I don't know if you're doing this as a hobby or for your job. If the latter, you might want to consider getting external help for this low-level stuff, so you can focus on your actual work. Doing the kind of work I described here is what I do for a living. But in any case, I'm happy to answer your questions, so ask away.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.