QT5 LinuxFB rotation for LCDs patch

I wrote up this patch as I needed to get a landscape display on a LCD which was actually intended for portrait (and so its resolution and framebuffer had to be setup for portrait, it was just physically oriented as landscape). This is a common problem for people using ILI9341/ILI9340 controllers found on cheapo TFT LCDs. These LCDs come setup for a portrait mode on the RGB interface with no option to change it, they do have an SPI interface where you can alter the settings but the display data must always be sent over SPI.

Read more

Using SAMD Emulated EEPROM ASF driver coming from the 8-bit micro world

Introduction In a typical 8-bit microcontroller application with real EEPROM, I used to have to read EEPROM byte by byte to obtain values I want and store them into variables in the world of PIC16/18s (how awful they are). Or in the case of AVRs, I had the nice helper functions provided by <avr/eeprom.h> Now the SAMD with it’s emulated EEPROM ASF driver, things suddenly get more interesting. Now when you read the “EEPROM”, you get 60 bytes back.

Read more

sam3x can mailbox 0

I spent some time wondering why the first message received in my mailbox 0 of CAN0 on a SAM3X was giving me a invalid message ID but the data was correct and all subsequent messages with ids were always correct. Turns out that mailbox 0 for some reason on the SAM3X is broken and will always show this behavior after the can controller initialized. Whether it’s a big deal or not depends on application.

Read more

ASF: SAMD ADC Callback Driver Risky Bug with Jobs

I encountered a rather dangerous bug when using a SAMD21 with the ASF ADC Callback driver as of ASF 3.20.1 In the callback driver, to start interrupts you would do adc_register_callback(&adc_instance, adc_complete_callback, ADC_CALLBACK_READ_BUFFER); adc_enable_callback(&adc_instance, ADC_CALLBACK_READ_BUFFER); uint16_t adc_buffer[8] = {0}; adc_read_buffer_job(&adc_instance,adc_buffer,8); after configuration of the ADC of course. Then the ADC callback will be /** * \brief ADC complete callback, stores ADC measurement * * \param module ADC Module */ void adc_complete_callback(const struct adc_module *const module) { measurement = adc_buffer[0]; } This will work just fine.

Read more

ASF: SAMD21 DPLL for internal clock from internal 8MHz.

The SAMD21 comes with a DPLL peripheral which allows scaling up an reference clock up from 48 to 96MHz variably. It can then be used as the source for the CLK_MAIN that runs the CPU. This is a quick little guide on how to upscale the internal 8MHz clock to run the CPU clock at a higher frequency. This is particularly useful when needing performance and you are running the DFLL for USB clock recovery.

Read more