@@ -10,6 +10,10 @@ With 2x A4950s on the DAC, AS5047P on the encoder, etc.
- haven't tested with '+ve' signed calibrations, i.e. if motor += magnetic step does encoder += tick step.
## Evaluation
- static holding, watch encoder wobble when torque applied (can see ticks moving around even w/o motor torque being overcome), measure again with closed loop: can we hold *better* than static pointing?
## 2020 10 06
OK, today am just waking this thing up. Have magnet glued (curing) on the back of the motor now, and one encoder soldered up on an old module-based stepper board - code should be the same.
...
...
@@ -549,7 +553,7 @@ Yeah this looks all kinds of wrong.
Borked, indeed. Will check tomorrow. Errors just before the BI (nan, so our of index somewhere?) and the BI looks close but not quite there.
## 2020 10 08
## 2020 10 09
Ok, updating the interpolation, seems messy but I think (?) maybe this shot will work - at least for -ve signed samples.
So next up is writing that to flash so that I can use it.
\ No newline at end of file
So next up is writing that to flash so that I can use it.
Alright! Flash memory.
Seems like I've most of it written - just copying from mechaduino, but after I write these out, I freeze up the micro.
Yeah, welp, I think I might have to get into the datasheet and do this au manuel. I've learned that when I declare a const variable, it goes into the flash memory. I think my 'alignment' of that will set it up in pages, so I 'align' it to the page size, which I can read to be 512 bytes... I'll take a minute, see how this goes. Bummer it's Friday, I was pumped to get this up and running this week.
## 2020 10 13
Setting up the NVM Controller today to try to write pages into flash. Not sure why this was crashing before, probably something simple.
I don't think there's a clock / init I have to do to wake up the flash controller, seems like that would be kind of crazy. Yeah, 25.6.1.1 clarifies this.
I'm also not sure where the bootloader is in here, and seems likely that I might write it over.
'addressable on the AHB bus'
I think I almost get this, need to figure this note about disabling cache.. some erratta... am at 25.6.6
Trying with just doing automatic quad word writing, which I think auto increments the page-write pointer, not sure about what happens for the page buffer though. I should check via the mechaduino code and flash storage code...
Ok this is hella opaque, 25.6.6.2 ... `procedure for manual page writes`
- the block to be written must be erased before the write command is given
- write to the page buffer by addressing the nvm main address space directly (crazy)
- cmd = wp to write the full contents of the page buffer into the nvm at the page pointed to by addr
I fully don't understand this, but it seems like it should be straightforward. Likely next step is to burn it all down and try again from scratch. I should see if I can write *anything* and move away from this calib-then-write situation, which is probably complicating things.
#### Aboot Flash
Have to erase before write, to set back to 1's: flash memory writes by pulling zeroes low, and has to operate in blocks.
I can also check the UF2 bootloader, which uses flash: