I have a project with a custom board running a 328PB. I'm logging a thermocouple, barometric pressure, a pulse frequency, 4 adcs, and a 19200baud serial data stream. I'm then broadcasting these sensors to a ECU using a MCP2515. So far I've done everything in arduino using minicore hardware package. I've made my own "libraries" for the max31856, bmp280, using timer/counter for frequency measurement, and sync'ing the serial data stream. It works, actually pretty well!
My ECU allows can passthru, so I should be able to update some values on this device without going through a whole flash write. For most of these values eeprom is more than enough. However, I'd like to store 4 2048 byte lookup tables to flash for 10 bit thermistor or MAF lookup tables. The ECU allows a easy way to program and output a table over canbus from a laptop, I'd rather not fight that format. I could just pass the calibration parameters into eeprom and run the calculation every time for thermistors, but non linear sensors like MAFs won't work that way, sending a lookup table would work a lot better.
I've poked about in the datasheet and it looks like I should be able to do this, but I can only execute code that resides in a smaller chunk of flash. If I try and access the lower 2/3ds of flash for code to update the flash, CPU crash?
I am still using a library for the MCP2515, and I have no way of telling where anything else goes in flash. I think I could just about fit all my code in the NRWW section, I've not been flash limited so I've been rather inefficient in my coding...
Is this just asking too much from the arduino environment? I find very little about writing flash pages from a program and even less about arranging flash memory. Does anyone know of any open source projects that might use a similar function I can examine? Once I know where everything is at in flash, or how I can forcibly arrange it, I think I can figure out actual erase/write code from the datasheet.
Thank you in advance for any advice!